[sldev] Re: -Werror problem in trunk

Mana Janus mana.janus at web.de
Thu Aug 21 09:28:29 PDT 2008


Jason Giglio wrote:
> Soft wrote:
>   
>>> look at the definition of the struct at llrender.h 221;
>>>
>>> the name of the struct is not in the "correct" place :-
>>>
>>>  typedef struct Vertex
>>>                {
>>>                        GLfloat v[3];
>>>                        GLubyte c[4];
>>>                        GLfloat uv[2];
>>>                };
>>>
>>> should be :-
>>>
>>> typedef struct
>>>        {
>>>                        GLfloat v[3];
>>>                        GLubyte c[4];
>>>                        GLfloat uv[2];
>>>         } Vertex;
>>>
>>>
>>> gcc 4.3 is a lot more fussy about syntax. That should fix it.
>>>       
>
> Is this actually the right way to go?  Isn't the preferred syntax to
> actually just say "struct Vertex { ... };".
>
> -Jason
>   

Absolutely, Jason, if you are using C++ only. "typedef struct { ... } 
Vertex" is the old C way of doing it.
In C++ the simple "struct Vertex { ... }" has the exact same effect and 
should be preferred, when the header is never included from C.
After all, you are not doing "typedef class { ... } Name", are you? ;-)

Best regards,

Mana



More information about the SLDev mailing list