Messages in this thread | | | Date | Fri, 16 Dec 2005 06:22:24 -0700 | From | Matthew Wilcox <> | Subject | Re: typedefs and structs [was Re: [PATCH 16/42]: PCI: PCI Error reporting callbacks] |
| |
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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |