On Jan 18, 2008, at 6:55 PM, Dave Rolsky wrote: > People always talk about boundary alignments, and other gibberish. http://en.wikipedia.org/wiki/Data_structure_alignment Here's an example of an alignment problem: #include <stdlib.h> #include <stdio.h> #include <string.h> int main() { int foo = 1000; char *bar = (char*)malloc( sizeof(int) + 1 ); char *bar_plus_one = bar + 1; int baz; memcpy(bar_plus_one, &foo, sizeof(int)); baz = *(int*)bar_plus_one; /* boom? */ printf("%d\n", baz); return 0; } bar_plus_one isn't word-aligned. That code will work on some systems, but not others. Marvin Humphrey Rectangular Research http://www.rectangular.com/Thread Previous | Thread Next