why this code
#macro qwerty (_theStr_) : _ch_;
#for (_ch_ in _theStr_)
#print(@byte(_ch_));
#endfor;
#endmacro;
qwerty("qwerty")
when compiled prints equal numbers and not byte equivalents of chars in the string parameter?
When i change "@byte(_ch_)" to "byte(_ch_)" everithing is ok.
In examples for hla: strToBA.hla macro also uses @byte macro function and it compiled incorrectly
it may be seen in strToBA.data.inc produced by hla

please,explain me is this a bug or there is some reason for such different results
Posted on 2004-03-16 07:16:44 by Elohim Meth

why this code
#macro qwerty (_theStr_) : _ch_;
#for (_ch_ in _theStr_)
#print(@byte(_ch_));
#endfor;
#endmacro;
qwerty("qwerty")
when compiled prints equal numbers and not byte equivalents of chars in the string parameter?
When i change "@byte(_ch_)" to "byte(_ch_)" everithing is ok.
In examples for hla: strToBA.hla macro also uses @byte macro function and it compiled incorrectly
it may be seen in strToBA.data.inc produced by hla

please,explain me is this a bug or there is some reason for such different results



The "byte( parm )" compile-time function will do an actual translation, if necessary, of its operand when converting to a byte. The "@byte( parm )" function, on the other hand, just copies bits. Most of the time these functions do exactly the same thing. Strings happen to be one area where their semantics differ. @byte returns the L.O. byte of the string pointer (that is, the string converted to a bit string) and "byte" returns the string converted to its numeric form. Of course, the converted bit string probably isn't very interesting (though converted bit strings of other data types *are* interesting, particularly, floating point numbers, csets, and stuff like that).
Cheers,
Randy Hyde
Posted on 2004-03-17 09:36:43 by rhyde
Thanks for reply. This explanation i saw in HLA documentation about byte and @byte,
but i thought that in this example _ch_ is char data type not string and @byte function
will make the same result with byte func.
And also i was mistaken by example from hla 1.61 strToBA.hla. It this example was used same method and @byte macro function.
Posted on 2004-03-17 11:46:56 by Elohim Meth
I also forget to mention about 2 invlaid constants in w.hhf

HWND_MESSAGE := 3; must be HWND_MESSAGE := -3;
SOCKET_ERROR := 1; must be SOCKET_ERROR := -1;
Posted on 2004-03-17 15:50:04 by Elohim Meth