Re: missing return statement

2009-03-13 Thread Dave Korn
Andreas Schwab wrote: > James Dennett writes: > >> This appears to be a difference between C and C++. Unfortunate. >> 6.6.3 [stmt.return]/2 of N2800 says "Flowing off the end of a function >> is equivalent to a return with no value; this results in undefined >> behavior in a value-returning func

Re: missing return statement

2009-03-13 Thread Andreas Schwab
James Dennett writes: > This appears to be a difference between C and C++. Unfortunate. > 6.6.3 [stmt.return]/2 of N2800 says "Flowing off the end of a function > is equivalent to a return with no value; this results in undefined > behavior in a value-returning function." Since it's merely unde

Re: missing return statement

2009-03-12 Thread James Dennett
On Thu, Mar 12, 2009 at 11:29 PM, Dave Korn wrote: > James Dennett wrote: >> On Thu, Mar 12, 2009 at 4:56 PM, Robert Dewar wrote: >>> Nathan Ridge wrote: >>> Why does gcc not give an error about this? If I compile with "-Wall", it will give a WARNING saying "control reaches end of

Re: missing return statement

2009-03-12 Thread Dave Korn
James Dennett wrote: > On Thu, Mar 12, 2009 at 4:56 PM, Robert Dewar wrote: >> Nathan Ridge wrote: >> >>> Why does gcc not give an error about this? >>> If I compile with "-Wall", it will give a WARNING saying >>> "control reaches end of non-void function". >>> However, shouldn't it be an ERROR t

RE: missing return statement

2009-03-12 Thread Nathan Ridge
> On Thu, Mar 12, 2009 at 4:56 PM, Robert Dewar wrote: >> Nathan Ridge wrote: >> >>> Why does gcc not give an error about this? >>> If I compile with "-Wall", it will give a WARNING saying >>> "control reaches end of non-void function". >>> However, shouldn't it be an ERROR to return nothing >>> f

Re: missing return statement

2009-03-12 Thread James Dennett
On Thu, Mar 12, 2009 at 4:56 PM, Robert Dewar wrote: > Nathan Ridge wrote: > >> Why does gcc not give an error about this? >> If I compile with "-Wall", it will give a WARNING saying >> "control reaches end of non-void function". >>  However, shouldn't it be an ERROR to return nothing >> from a fu

Re: missing return statement

2009-03-12 Thread Robert Dewar
Nathan Ridge wrote: Why does gcc not give an error about this? If I compile with "-Wall", it will give a WARNING saying "control reaches end of non-void function". However, shouldn't it be an ERROR to return nothing from a function that's supposed to return something? Does this not result in

Re: missing return statement

2009-03-12 Thread Ben Elliston
(Note that this is really a question for gcc-help.) On Thu, 2009-03-12 at 23:42 +, Nathan Ridge wrote: > Why does gcc not give an error about this? > If I compile with "-Wall", it will give a WARNING saying > "control reaches end of non-void function". You can turn this warning into an error