This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH] Fix PR gdb/290
- From: Joe Buck <jbuck at synopsys dot COM>
- To: ac131313 at cygnus dot com (Andrew Cagney)
- Cc: kettenis at chello dot nl, gcc at gcc dot gnu dot org,gdb-patches at sources dot redhat dot com
- Date: Sat, 9 Feb 2002 11:36:53 -0800 (PST)
- Subject: 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.