This web mail archive is frozen.
This page is part of a frozen web archive of this mailing list.
You can still navigate around this archive, but know that no new mails
have been added to it since July of 2016.
Click here to be taken to the new web archives of this list; it includes all the mails that are in this frozen archive plus all new mails that have been sent to the list since it was migrated to the new archives.
On Jun 29, 2011, at 10:56 AM CDT, Jeff Squyres wrote:
> There's probably an alignment gap between the short and char array, and possibly an alignment gap between the char array and the double array (depending on the value of SHORT_INPUT and your architecture).
> So for your displacements, you should probably actually measure what the displacements are instead of using sizeof(short), for example.
> tVStruct foo;
> aiDispsT5 = 0;
> aiDispsT5 = ((char*) &(foo.sCapacityFile) - (char*) &foo);
There's a C-standard "offsetof" macro for this calculation. Using it instead of the pointer math above greatly improves readability: http://en.wikipedia.org/wiki/Offsetof
So the second line becomes:
aiDispsT5 = offsetof(tVStruct, sCapacityFile);