[squeak-dev] Struct with doubles

Igor Stasenko siguctua at gmail.com
Thu May 27 22:41:26 UTC 2010


On 28 May 2010 01:28, Schwab,Wilhelm K <bschwab at anest.ufl.edu> wrote:
> Hello all,
>
> I am faced with some win32 software that uses a structure like
>
> struct gizmo {
>  double x; y; z;
>  double q[4];
> }
>
> Would it be legal to treat that as
>
> struct gizmo {
>  double x; y; z;
>  double q0; q1; q2; q3;
> }
>
yes.

But there could be other issues, like fields alignment (which is not
for gizmo , since its fields are 8-bytes wide).


> and then let Pharo define the fields?  This is running on 32 bit winxp.  A colleague is doing 3D magic with the resulting numbers, but Weird things appear to be happening.  I am looking for ways that I might be causing them.  It is also possible that the gizmo to which we are interfacing is just plain broken.
>

At the last resort, just compile a simple C program which prints an
offsets to these fields, like:

gizmo z;

printf ("%d\n" , &(z.q[3]) - &z  );


> Bill
>
>
>
>



-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list