Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: [BUG] in make struct! ?

From: g:santilli:tiscalinet:it at: 5-Aug-2003 0:26

Hi rebOldes, On Monday, August 4, 2003, 7:59:53 PM, you wrote: r> if it would be padding, why this struct is not padded as well:
>>> s: make struct! [a [short] b [short] c [short]] [1 2 3] third s
r> == #{010002000300} A short is 16 bit. Usually CPUs require them to be evenly aligned.
>> third make struct! [a [char] b [short]] [#"^(01)" 2]
== #{01000200} Indeed, on my system you get a pad byte in this case. You don't need padding if you are aligned already:
>> third make struct! [a [char] a' [char] b [short]] [#"^(01)" #"^(02)" 3]
== #{01020300} You get the same results if you create these structures in a C compiler (i.e. the compiler adds the required pad bytes as REBOL does). Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/