[comp.std.c] Is "void f

rfg@paris.ics.uci.edu (Ronald Guilmette) (04/08/90)

It's got to be a simple question if I can get the whole thing into the
subject line!

For those who missed the subject line, I'd like to know if this is legal:

	void f (int i) { return (void) i; }


// Ron Guilmette (rfg@ics.uci.edu)
// C++ Entomologist
// Motto:  If it sticks, force it.  If it breaks, it needed replacing anyway.

gwyn@smoke.BRL.MIL (Doug Gwyn) (04/09/90)

In article <261E9779.25257@paris.ics.uci.edu> rfg@paris.ics.uci.edu (Ronald Guilmette) writes:
>For those who missed the subject line, I'd like to know if this is legal:
>	void f (int i) { return (void) i; }

3.6.6.4 The return statement
Constraints
	A return statement with an expression shall not appear in a
function whose return type is void.

andrew@ambush.dk (Leif Andrew Rump) (04/13/90)

rfg@paris.ics.uci.edu (Ronald Guilmette) writes:
>For those who missed the subject line, I'd like to know if this is legal:
>	void f (int i) { return (void) i; }

As Doug Gwyn (i think it was) correctly states is it illegal _but_
it is a bit puzzling at first to see that void * is legal but I sure
rather want that than char * as it was in malloc and other in the past

Leif Andrew Rump, AmbraSoft A/S, Stroedamvej 50, DK-2100 Copenhagen OE, Denmark
    UUCP: andrew@ambra.dk (Please note name change), phone: +45 39 27 11 77
    Currently at SAS (Scandinavian Airline Systems), phone: +45 32 32 22 79

 > > Read oe as: o <backspace> / (slash) and OE as O <backspace> / (slash) < <