The comment concerning complication of size computation deals with the fundamental differentiation of C with vs. without flexible array member support (i.e. C90 vs. C99). When using a singular element array within your struct, the element contributes to the sizeof()
the type. Therefore the flexible size computation used for real flexible arrays won't work:
In C90:
struct name
{
int namelen;
char namestr[1]; // contributes 1 + potential padding to sizeof(name)
};
// using "the one" [1] as our terminator
struct name *p = malloc(sizeof(name) + strlen(str))
whereas in C99 with a flexible member
struct name
{
int namelen;
char namestr[]; // contributes no definitive value to sizeof(name)
};
// specifying space for our terminator, since [] gives us nothing.
struct name *p = malloc(sizeof(name) + strlen(str) + 1)
If you're wondering about that comment concerning no contribution to space,
C99 §6.7.2.1 Structures and Union Specificers
18 As a special case, the last element of a structure with more than one named member may
have an incomplete array type; this is called a flexible array member. In most situations, the flexible array member is ignored. In particular, the size of the structure is as if the flexible array member were omitted except that it may have more trailing padding than the omission would imply. ....
C90 makes no such niceties, and as such the structure must be allocated differently (and arguably in a manner that is unspecified, if not outright undefined).