zero sized structs
nadult
nadult@gmail.com
Thu Nov 13 01:28:00 GMT 2008
Hello, i have some problems with empty (almost) structures containing
zero-sized arrays:
struct Zero { int value[0]; };
int main() {
std::cout << "sizeof(Zero)==" << sizeof(Zero) << '\n';
return 0;
}
The output i get for every g++ i compile it on is:
sizeof(Zero)==0
Because of that i can't, for example, create a vector of Zero's, i get
division by 0 error in max_size().
Is this a bug, or maybe zero-sized arrays are gcc extension not fully
supported in g++?
More information about the Gcc
mailing list