[Gambas-user] Some new features in Gambas 3

Benoît Minisini gambas at ...1...
Sat Jan 1 17:34:42 CET 2011


> > 2) A new set of native functions named Mk<XXX>$() to create a string from
> > the
> > memory representation of a value. For example, MkShort$(1234) returns
> > Chr$(210) & Chr$(4) (on a little endian machine).
> 
> I'm updating GambasTester to handle new commands and features.
> 
> And I don't quite understand these new functions...
> MkByte$(65) returns "A" which is expected if string is created with ascii
> encoding.
> But MkBoolean(True) returns "^A", and according to documentation boolean
> value size is one byte
> in memory. This string occupies two bytes?

"^A" is the way the IDE console displays Chr$(1).

> 
> But moreover, what is intended use of these functions?

One ask them to forge a string of binary data to be sent on an UDP socket. But 
this is not necessarily the right way to do that, as data on the network must 
be endianness-agnostic. So maybe these functions are not really useful indeed.

Regards,

-- 
Benoît Minisini




More information about the User mailing list