Re: Redundant return()
pembed2012 <once@was.enough.invalid> writes:
> sorry function shall be a VOID function :-)
>
> On Sat, 12 May 2012 21:41:12 +0000, pembed2012 wrote:
>> I have seen redundant return statements at the end of function. IE.
>> init_function()
>> {
>> a_init();
>> b_init();
>> c_init();
>> return();
>> }
>> I checked the generated code in GCC Compiler 3.2.2 on Red Hat Linux it
>> is ignored so it not harmful to use this.
>>
>> Has anybody got any problem/issues with this on any compiler/platform?
Well... no problem with the explicit return (I'm pretty sloppy about
whether I use them or not), but there is a problem with your example
(just to be sure, I checked and here's what gcc told me):
bogus.c:13:12: error: expected expression before ‘)’ token
bogus.c:13:5: warning: ‘return’ with a value, in function returning void [enabled by default]
|