> Benoit,
> 1) What version is struct implemented?

I think you want to know that structures are implemented in Gambas 3 only.

> 2) Reading and writing a struct to a stream (file, etc) is an exact copy of
> the struct? 

Of course not. Data is serialized.

Writing (or reading) a structure is exactly like writing (or reading) each 
field with the WRITE (or READ) instruction. This is done recursively if there 
are structures inside structures.

Consequently, as soon as you don't use strings, the data written to the stream 
will look like what is stored in memory, but without padding (see the next 
question).

> 3) Does struct pad with bytes to fit alignments or is it exact
> as defined? 

There is padding, so that an short is stored at a memory address multiple of 
2, an integer or a single at a memory address multiple of 4, a long, a float 
or a date at a memory address multiple of 8. A more complex datatype (a 
pointer, an object reference, an embedded structure or array) is stored at an 
address multiple of 4 on a 32 bits system, and at an address multiple of 8 on 
a 64 bits system. Finally, an entire object is padded so that its size is a 
multiple of 4 on a 32 bits system, and a multiple of 8 on a 64 bits system.

> 4) This is similar to RECORD in VB.

I don't know.

Regards,

-- 
Benoît Minisini

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to