devxlogo

September 5, 1998

Member Alignment

Manual calculation of a struct/class size is not just an indication of poor design and a source of maintenance problems; it may also lead to bugs that are very hard

Sizeof or strlen()?

What’s wrong with the following code excerpt? const char name[] = “john doe”; //9 characters, null char implicitly added by compilersize_t namesz = strlen(name); //namesz equals 8! Nothing, in fact.