[Gambas-devel] ideas for two new string functions

Kevin Fishburne kevinfishburne at ...590...
Thu Nov 25 02:24:33 CET 2010


On 11/24/2010 05:46 PM, Benoît Minisini wrote:
> I changed my mind.
>
> I replaced Mem$() by specific Mk*$() functions: MkBool$(), MkByte$() - stupid,
> as it is the same as Chr$()! - MkShort$()...
>
> And now I notice a problem: these functions (and their counterpart, Bool@,
> Byte at ...570...) use endianness, so you cannot use them to exchange data between a
> big-endian computer and a little-endian computer.
>
> I think the right solution would be using structures, and adding something to
> convert a entire structure into a string. And, better, allowing READ and WRITE
> to read/write structures directly to a stream.
>
> That way, you will define your messages as structures, and just use READ and
> WRITE to send them to your UDP sockets in a endianness-agnostic way.
That is a better solution. I'm still stuck in the old QB/VB mindset, but 
your solution is more elegant and requires less coding, maintenance and 
documentation. The efficient ability is what's important, so as long as 
the implementation is logical it will add a lot. I'll code using patched 
gb2 but am looking forward to gb3.

-- 
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...590...
phone: (770) 853-6271





More information about the Devel mailing list