F
Frederick Gotham
What are your thoughts on the following code?
typedef int Coords[3];
int main()
{
Coords *const p = new Coords;
delete p;
}
It doesn't compile with g++ on my system, saying:
cannot convert `int*' to `int (* const)[3]' in initialization
Half of me thinks that Coords is just an array in disguise and that the error
is justified, and the other half thinks that Coords is a new fully-fledged
type and that the code should be OK.
Thoughts?
typedef int Coords[3];
int main()
{
Coords *const p = new Coords;
delete p;
}
It doesn't compile with g++ on my system, saying:
cannot convert `int*' to `int (* const)[3]' in initialization
Half of me thinks that Coords is just an array in disguise and that the error
is justified, and the other half thinks that Coords is a new fully-fledged
type and that the code should be OK.
Thoughts?