This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR gdb/290


Andrew writes:
> static void f3 (void) { return; }
> ...
> so ok so far.  Hmm, I think this tells the story:
> 
> static void f5 (int a) { return f3(); }
> 
> Returning the result from a function that returns void (f3()) doesn't 
> attract a warning.

> Bug or feature?

For C++, it is a non-optional feature; the standard requires this to work
correctly (a void function may say "return foop();" if foop's return type
is void).  The reason for this will become clear after you write templates
for a while; without it "void" becomes more of an oddball case.

For C89, I don't think it's legal though it may be reasonable to accept
as an extension; I don't know about C99.


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