News for hackers. Stuff that matters.
Re:C Craft by cpr on Friday December 18, 2009 @01:43PM (#1003660)
Well, being pedantic, that should be

  struct thing *foo = malloc(sizeof(struct thing) + sizeof(char) * i_need);
since sizeof(char) isn't guaranteed to be 1 byte on all systems.
Re:C Craft by pavlov on Friday December 18, 2009 @02:06PM (#1003714)
Actually, the C standard guarantees that char is equal to one byte.
Re:C Craft by neild on Friday December 18, 2009 @02:18PM (#1003741)
More to the point, it defines a byte in terms of a char. sizeof(char) will always be 1, but UCHAR_MAX need not be 255.