Comments on: Introducing Flexible Array Members You are right that the C++ standard (either '98 or 0x) does not include support for flexible arrays, so in a purely theoretical sense, it is not supported in C++. Using flexible array members is not standard compliant C++ programming, so shouldn't really be used in code that is supposed to be fully portable / cross platform. That said, as far as I know all current compliers for mainstream gaming platforms DO support it, and will behave as expected. It is also true that classes that are used as a base class cannot use this technique, but that is a design constraint that is probably acceptable at the point in development when this kind of optimisation becomes useful. My plan for my next post is to go into more detail on the use of this kind of optimisation, and hopefully will be able to also cover how to handle some of the trickier situations. You are right that the C++ standard (either ’98 or 0x) does not include support for flexible arrays, so in a purely theoretical sense, it is not supported in C++. Using flexible array members is not standard compliant C++ programming, so shouldn’t really be used in code that is supposed to be fully portable / cross platform.

That said, as far as I know all current compliers for mainstream gaming platforms DO support it, and will behave as expected.

It is also true that classes that are used as a base class cannot use this technique, but that is a design constraint that is probably acceptable at the point in development when this kind of optimisation becomes useful.

My plan for my next post is to go into more detail on the use of this kind of optimisation, and hopefully will be able to also cover how to handle some of the trickier situations.

]]>
By: Jesse Cluff/2011/06/03/introducing-flexible-array-members/#comment-5307 Jesse Cluff Wed, 08 Jun 2011 01:14:00 +0000 I definitely prefer the GNU-style of <code>char array[0]</code> as in other contexts <code>char array[]</code> is a pointer to an array of char (e.g. in a function declaration). I definitely prefer the GNU-style of char array[0] as in other contexts char array[] is a pointer to an array of char (e.g. in a function declaration).

]]>
By: Tomasz Dąbrowski/2011/06/03/introducing-flexible-array-members/#comment-5127 Tomasz Dąbrowski Fri, 03 Jun 2011 20:29:06 +0000 ;) But it means that this technique is important performance optimization.

]]>
By: Kevin Gadd/2011/06/03/introducing-flexible-array-members/#comment-5126 Kevin Gadd Fri, 03 Jun 2011 20:12:18 +0000