This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

bug or feature ?



Gcc allows a void function to return a value. it only gives a warning.
Is this a bug or a feature?

there is a demo code that demonstrates this.

/* demo.c */
void foo(int x)
{
   return x;
}

$gcc -c demo.c
demo.c: In function `foo':
demo.c:4: warning: `return' with a value, in function returning void
$


-neelakanth

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]