Re: typedefs and structs [was Re: [PATCH 16/42]: PCI: PCI Error reporting callbacks]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 16, 2005 at 03:09:01PM +0200, Denis Vlasenko wrote:
> 
> Forward decl for typedef works too:
> 
> typedef struct foo foo_t;
> 
> is ok even before struct foo is defined. Not sure that standards
> allow thing, but gcc does.

Forward declarations of typedefs don't work in at least one case that
do for struct definitions:

$ cat foo.c
typedef struct foo foo_t;
typedef struct foo foo_t;
$ gcc -Wall -o foo.o -c foo.c
foo.c:2: error: redefinition of typedef 'foo_t'
foo.c:1: error: previous declaration of 'foo_t' was here

and if you don't believe we do that, take another look at our headers
sometime.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux