Function declared returning something returns nothing

Alexandre Oliva oliva@dcc.unicamp.br
Fri Apr 30 23:15:00 GMT 1999


On Apr 22, 1999, Edward_C_Morgan <ecmorgan@lucent.com> wrote:

> My question is: Shouldn't the compiler warned about functions not
> returning anything, or at least not returning what it says it
> returns?

It warns with -Wall.  According to the standard, falling off the end
of a function that does not return void produces undefined
results. (except for main(), that implicitly returns 0)

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Brasil
{oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists




More information about the Gcc-bugs mailing list