I have a struct for holding a 4D vector
struct {
float x;
float y;
float z;
float w;
} vector4f
And I\'m using a library th
No, it is not legal. And almost any time you find yourself using a cast, you should suspect there is something deeply wrong with your code. I suspect that someone will shortly suggest using a union, but that will not be legal either.
Of course, legal or not, either the approach you suggest in your question or the use of a union will probably "work" - but that is not what you asked.