typedef struct
{
float x, y, z;
} sVertex;
and some people use
struct sVertex
{
float x, y, z;
};
Is it just a preference thing? They are both the same correct?
typedef struct
{
float x, y, z;
} sVertex;
and some people use
struct sVertex
{
float x, y, z;
};
Is it just a preference thing? They are both the same correct?
Quote:Original post by dcosborn
The second form provides namespace separation in C, enabling you to define variables like so:
struct vertex {float x, y, z;}; // define the type
struct vertex vertex; // construct a variable of that type
So the name vertex can describe both the structure's type and an instance. A similar thing can be done with enums.
Quote:Original post by Evil Steve
If I ever saw someone who wrote code like that without a really good reason, I'd set them on fire [smile]
Quote:Original post by EDI
<offtopic>Quote:Original post by Evil Steve
If I ever saw someone who wrote code like that without a really good reason, I'd set them on fire [smile]
And I would follow up with a can of gasoline [smile]
</offtopic>
Quote:Original post by Anonymous Poster
Hmm... for some reason the words I put between angle brackets dissapeared!