At 14:29 2007-02-02, peternilsson42 wrote:
>"Shyan Lam" <[EMAIL PROTECTED]> wrote:
> > Ray Devore <rbdevore2007@> wrote:
> > >
> > > I keep seeing two different ways to define a struct
> > > (see below). What is the benefit of doing the typedef
> > > over just defining the struct with a tag?
> >
> > In C language prior to C99, the struct tag alone cannot
> > be used to declare an object of struct type:
> >
> > struct MY_STRUCT
> > {
> > ...
> > };
> >
> > MY_STRUCT myObj; /* Error in C90 */
>
>It is still an error in C99.
geez, the committee is stupider than I thought.
> > In C++, the tag name can be used as a type without the
> > 'struct' keyword:
>
>True.
>
><snip>
> > C99 follow suit and adapted this syntax.
>
>Technically, it's valid syntax in that it follows the grammar,
>however it is (still) not semantically valid. Struct tags
>remain in a separate name space in C.
>
>--
>Peter
>
>
>
>To unsubscribe, send a blank message to
><mailto:[EMAIL PROTECTED]>.
>Yahoo! Groups Links
>
>
>
Victor A. Wagner Jr. http://rudbek.com
The five most dangerous words in the English language:
"There oughta be a law"