sizeof( function )

Brian Dessent brian@dessent.net
Tue Jun 12 17:27:00 GMT 2007


Nick Maclaren wrote:

> But this is actually a BUG in gcc - look at 5.1.1.3.  The restriction
> that sizeof may not have an argument that is function type is a
> constraint, and therefore a breach requires a diagnostic.

It would only be a bug if there was no diagnostic in non-GNU mode, e.g.
-std=c89.  Otherwise the default is -std=gnu89 if not specified and as
the other poster pointed out, GNU extensions allow this and define the
return value as 1 for convenience.

Brian



More information about the Gcc-help mailing list