🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #6248

Re: Does ANSI insist this is legal?

#6248
From: Doug Gwyn
Date: Wed, 28 Feb 1990 13:55
12 lines
1012 bytes
In article <25EB8750.5286@paris.ics.uci.edu> rfg@paris.ics.uci.edu (Ronald Guilmette) writes:
>Must a strictly conforming ANSI C implementation be able to generate an
>executable program from the following?
>	int main ();
>	short s = (short) &main;
>	char c = (char) &main;

No -- a pointer is required to be interconvertable to some particular
implementation-defined integral type, not necessarily short or char.
Also note that the initializers violate the definition of a constant
expression and thus need not be supported by an implementation even if
short or char were the appropriate integer to hold a pointer value.
Technical Details
Message-ID: <12254@smoke.BRL.MIL>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!aplcen!haven!adm!smoke!gwyn
References: <25EB8750.5286@paris.ics.uci.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!aplcen!haven!adm!smoke!gwyn
From: gwyn@smoke.BRL.MIL (Doug Gwyn)
Newsgroups: comp.std.c
Subject: Re: Does ANSI insist this is legal?
Message-ID: <12254@smoke.BRL.MIL>
Date: 28 Feb 90 13:55:28 GMT
References: <25EB8750.5286@paris.ics.uci.edu>
Reply-To: gwyn@brl.arpa (Doug Gwyn)
Organization: Ballistic Research Lab (BRL), APG, MD.
Lines: 12