FFI, Ogg Vorbis, and char[]
Andreas.Raab at gmx.de
Andreas.Raab at gmx.de
Mon Nov 25 10:56:51 UTC 2002
> On Sun, 24 Nov 2002, Jason Dufair wrote:
>
> > Bert Freudenberg wrote:
> >
> > >#( ...
> > > (header 'char' 282)
> > > ... )
> > >
> > >
> > Heh. Talk about a case of RTFM. Sorry I overlooked that.
>
> Actually it's more like RTFC. I discovered this by looking in
> ExternalStructure>>compileFields:withAccessors:. And I think giving the
> size in bytes is misleading, it should be multiple of the base type's
> size. That is, when I give it an (stuff 'int' 3) it should skip
> 12 bytes. Andreas?
Bytes is just right. The argument is intended for padding and it is also not
always clear what the size of the base type is. Consider something like:
typedef struct t_Color {
char r, g, b; /* three bytes */
} Color;
and then:
typedef struct t_DrawingAttribute {
Color rgb;
int lineWidth;
} DrawingAttribute;
Most compilers will align the line width to next word boundary and therefore
it's much easier to use byte sizes here.
Cheers,
- Andreas
--
+++ GMX - Mail, Messaging & more http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!
More information about the Squeak-dev
mailing list
|