4 ms·
You are probably confusing flexible array members with VLA. Those are two completely different features. You are thinking about the one where last member of str
by Karliss 4y ago
You are probably confusing flexible array members with VLA. Those are two completely different features. You are thinking about the one where last member of struct is an array and you adjust size based on malloc size when allocating struct. VLA feature allows you specifying arbitrary non constant expression when declaring local stack variables with array type. Something like:
// VLA
int foo(int n) {
int array[n];
}
// flexible array member
struct s { int n; double d[]; };
struct s s1 = malloc(sizeof (struct s) + (sizeof (double) 8));
- asveikau 4y agoI'm not confusing them. That's why I said flexible array member and not VLA. I don't need a lecture. I have actually lectured on C before. I do have them bucketed similarly in my mind. They are both c99 features about variable sized arrays. MS has not implemented either one iirc.
- xeeeeeeeeeeenu 4y ago>MS has not implemented either one iirc. Flexible array members were implemented a long time ago. The oldest Visual C++ I have at hand is 2005 and it already has them (although only in C mode).