On Fri, 10 Jul 2009, Szak�ts Viktor wrote:
> Sorry, for me it's still a pending question why at some places a char
> is represented by BYTE, on some others by UCHAR, and on some others
> USHORT.
> There surely is a logic in it, but I can't recognize it.
> Pls wait a little, I'm converting GT USHORTs to int. I'd appreciate if
> you'd review it.

It doesn't matter what we agree as base text holder.
Important is to respect pure C behavior in casting.
if we have:
   int iValue = ( UCHAR ) hb_parcx( 1 )[ 0 ];
and you change it to:
   int iValue = ( int ) hb_parcx( 1 )[ 0 ];
then for chr( 255 ) passed as 1-st parameter iValue will be -1 instead
of 255 on machines where char is signed value.
Similar situation happens when you change:
   [const] char* szText;
   ...
   ( UCHAR ) *szText
to:
   ( USHORT ) *szText
This will introduce problems for GTs which will store Unicode
values in screen buffer and will not ignore upper byte of character.

best regards,
Przemwk
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to