Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C Structs

Name: Anonymous 2009-03-24 12:22

Hi fags.

I need to know how portable c structs are for data transmission: are the fields in a fixed position determined by some standard?

Name: Anonymous 2009-03-27 9:33

>>66
It's no a c thing - it's related to the underlying architechure your working with, which the c compiler will have to fit with that. Some machines require things to be aligned on 32-bit boundaries for example, so a struct such as:

struct foo {
  char foo1;
  int  foo2;
};

will end up padded with a 3 byte gap between foo1 and foo2.

this is a helpful link to explain it
http://www.eventhelix.com/RealtimeMantra/ByteAlignmentAndOrdering.htm

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List