Strings and Byte arrays

Moderator: Benj

Post Reply
mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Strings and Byte arrays

Post by mnf »

Another strange bug..

I defined a macro returning a string... The variable I passed, however, was a byte array (aka a string :) )

This expanded to the following which then threw errors:
FCL_STR = FCM_ByteToHex(%[opn0%tmp%],%[len0%tsz%], FCL_X);
A simple demo showing this:
bug.fcfx
(6.41 KiB) Downloaded 176 times
Unfortunately the problem with FC not allowing this variable to be changed to a string (or strings back to byte arrays) meant it was bit more hassle than anticipated..

FC then bombed with the restart windows problem - which seems to be happening rather more often (I've maybe slipped a version on repair) - any progress sorting this?

Martin

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Strings and Byte arrays

Post by Benj »

Hi Martin,

A string and byte array in C are the same thing. In Flowcode they are slightly different in that a string when used as a parameter also passes the maximum size. Therefore this is what is causing the compilation error when you are using a byte array in place of the string.

A simple workaround for changing variable types in a macro is to duplicate the macro and when you are in the edit dialogue you can then change the various variable or parameter types. Another way is to edit the project file XML in a text editor but this is not ideal.
FC then bombed with the restart windows problem - which seems to be happening rather more often (I've maybe slipped a version on repair) - any progress sorting this?
We are investigating this but currently don't have a way of replicating the problem to allow us to get to the bottom of the problem. I had it happen several times a few months back but it has not returned since making me think it was something to do with the Windows environment maybe being in an unstable state while it updated itself.

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: Strings and Byte arrays

Post by mnf »

Thanks Ben,

FC - sort of thinks the array of byte is the same too - should throw an 'Can't convert to type' error - instead of the cryptic compiler message? But, yes - it was my mistake really :-)

The windows bug doesn't seem to have a common cause. I thought I'd hit on something when it happened a couple of times when fiddling with some properties. Need to crank up the auto-backup frequency!

Martin

Post Reply