Article View: comp.std.c
Article #1700Re: typedef void t; int f(t); ?
From: Dave Hanson
Date: Fri, 14 Sep 1990 20:03
Date: Fri, 14 Sep 1990 20:03
22 lines
1382 bytes
1382 bytes
In article <1990Sep14.012909.1987@twinsun.com> eggert@ata.twinsun.com (Paul Eggert) writes:
Is the following a conforming ANSI C program?
typedef void t;
int f(t);
int f(t) { return 0; }
3.5.4.3 (page 68 line 37) seems to say that line 2 is bad, because it mentions
the keyword `void' without talking about types. But 3.7.1 (page 83 line 6)
seems to say that line 3 is OK, because it talks about the void type. Surely
lines 2 and 3 are both OK, or both bad.
yes, this is a conforming program. the typedef simply equates t to void.
While we're on the subject, what about qualified voids?
int g(volatile void) { return 0; }
typedef volatile void c;
int g(c);
no, this program is in violation of the constraints of 3.7.1, which
stipulate that the single parameter must be either type void with
no identifier or a type other than void with an identifier.
Technical Details
Message-ID:
<2730@rossignol.Princeton.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!wuarchive!udel!princeton!cs!drhReferences:
<1990Sep14.012909.1987@twinsun.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!wuarchive!udel!princeton!cs!drh From: drh@cs.Princeton.EDU (Dave Hanson) Newsgroups: comp.std.c Subject: Re: typedef void t; int f(t); ? Message-ID: <2730@rossignol.Princeton.EDU> Date: 14 Sep 90 20:03:11 GMT References: <1990Sep14.012909.1987@twinsun.com> Organization: Dept. of Computer Science, Princeton University Lines: 22