I am writing a low-lewel data manipulation code in C++ 11 and I want to use an old-known C feature of flexible arrays at the end of the struct (see some info here).
struct variableCell
{
/**
* @brief Size in bytes of following data.
*/
std::uint32_t cellSize;
/**
* @brief Data stored in overlay.
*/
std::uint8_t cellData[];
};
Once I use GCC with the paramaters
-Wall -pedantic -std=c++11
I get this waring
xxx.h:xx: warning: ISO C++ forbids zero-size array 'variableCell' [-Wpedantic]
This used to be a perfectly correct feature. Please, do not tell me that my approach is wrong - it is and always has been correct way for low-level data manipulation.
Why the standard changed this and how to disable just this one particular warning?
Thanks
Edit: My apologies, I mistaken the C only feature which turned to be one of the exceptions which does not the C++ include. I will consider using a different approach. But just for my curiosity, which compilers allows this as a non-standard extension and how to make them accept it without the warning?
Thanks