Path: 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 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.