This is _not_ a bug.  This is _C_, not C++.  ISO C99 
requires a diagnostic for it.  I think what's going on is 
that the compiler is warning about a return with a value 
in function returning void in foo(), but baz() is trying 
to return a value from a function that never returned 
anything.  This is probably a confusingly worded warning.  

Samuel Lauber

> > Given this program:
> >   static void foo(void) { return(1); }
> >   static void bar(void) { }
> >   static void baz(void) { return(bar()); }
> >   int main(int argc, char * argv[]) {
> >     baz();
> >     return(1);
> >   }
> >
> > A compile without -pedantic gives a warning for foo(), but not for
> > baz():
> >   $ gcc-3.4 foo.c
> >   foo.c: In function `foo':
> >   foo.c:1: warning: `return' with a value, in function returning void
> >
> > A compile with -pedantic gives a warning for both functions.
> >   $ gcc-3.4 -pedantic foo.c
> >   foo.c: In function `foo':
> >   foo.c:1: warning: `return' with a value, in function returning void
> >   foo.c: In function `baz':
> >   foo.c:3: warning: `return' with a value, in function returning void
> 
> The code in baz() is perfectly legal since ISO C++ allows void
> returns. -pedantic should not warn about it because it is not a GCC extension
> at all. Would you please file a bugreport about the incorrect warning emitted
> for baz()?
> 
> Thanks
> Giovanni Bajo

-- 
_____________________________________________________________
Web-based SMS services available at http://www.operamail.com.
From your mailbox to local or overseas cell phones.

Powered by Outblaze

Reply via email to