Awesome! My next question was going to be whether there is any support for packed structs. I am trying to read data from a file that uses packed structures, so your vocabulary will fit perfectly. (I figured someone else had probably done this, and it is beyond my current Factor prowess).
---- John Benediktsson <[email protected]> wrote: > I wrote a "packed struct" vocabulary that aligns to single bytes, if you > need that behavior. > > https://github.com/mrjbq7/re-factor/blob/master/classes/struct/packed > > > Using it, you can see that: > > ( scratchpad ) PACKED-STRUCT: packed-junk { a char } { b ushort } ; > > ( scratchpad ) packed-junk heap-size . > 3 > > > > > On Wed, Jul 13, 2011 at 10:34 AM, <[email protected]> wrote: > > > Ahhh, thanks. > > > > > > ---- Joe Groff <[email protected]> wrote: > > > On Jul 13, 2011, at 7:03 AM, <[email protected]> < > > [email protected]> wrote: > > > > > > > Suppose I have the following STRUCT: definition: > > > > > > > > STRUCT: junk { a char } { b ushort } ; > > > > > > > > I expected the heap-size of junk to be 3, but it turns out to be 4. > > Does alignment have something to do with this or is it something else? > > > > > > Structs follow C alignment rules. ushorts are 2-byte-aligned. > > > > > > -Joe > > > > > ------------------------------------------------------------------------------ > > > AppSumo Presents a FREE Video for the SourceForge Community by Eric > > > Ries, the creator of the Lean Startup Methodology on "Lean Startup > > > Secrets Revealed." This video shows you how to validate your ideas, > > > optimize your ideas and identify your business strategy. > > > http://p.sf.net/sfu/appsumosfdev2dev > > > _______________________________________________ > > > Factor-talk mailing list > > > [email protected] > > > https://lists.sourceforge.net/lists/listinfo/factor-talk > > > > > > > > ------------------------------------------------------------------------------ > > AppSumo Presents a FREE Video for the SourceForge Community by Eric > > Ries, the creator of the Lean Startup Methodology on "Lean Startup > > Secrets Revealed." This video shows you how to validate your ideas, > > optimize your ideas and identify your business strategy. > > http://p.sf.net/sfu/appsumosfdev2dev > > _______________________________________________ > > Factor-talk mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/factor-talk > > ------------------------------------------------------------------------------ AppSumo Presents a FREE Video for the SourceForge Community by Eric Ries, the creator of the Lean Startup Methodology on "Lean Startup Secrets Revealed." This video shows you how to validate your ideas, optimize your ideas and identify your business strategy. http://p.sf.net/sfu/appsumosfdev2dev _______________________________________________ Factor-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/factor-talk
