Xref: utzoo comp.lang.c:40143 comp.lang.c++:14161 Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!think.com!compass!worley From: worley@compass.com (Dale Worley) Newsgroups: comp.lang.c,comp.lang.c++ Subject: Type of "xxx" (was: array side-effect) Message-ID: Date: 17 Jun 91 18:56:07 GMT References: <91165.095327PRD3@psuvm.psu.edu> <91165.174358KQS@psuvm.psu.edu> Sender: root@compass.com Organization: Compass, Inc., Wakefield, MA, U.S.A. Lines: 19 In-reply-to: KQS@psuvm.psu.edu's message of 14 Jun 91 21:43:58 GMT In article <91165.174358KQS@psuvm.psu.edu> KQS@psuvm.psu.edu (Kevin Sullivan) writes: second: "9" evaluates to a (const char *), not a char. Sorry, the type of "9" is (char *). The ANSI committee discovered that too much code would break if its type was (const char *), because you couldn't do things like: char *p = "abc"; (You can't assign a pointer-to-constant-T to a pointer-to-T.) See section 3.1.4 of the standard and rationale. (Actually, the type of "9" is "array of 2 chars", which is almost always immediately coerced into "pointer to char".) Dale Worley Compass, Inc. worley@compass.com -- The notion of a "record" is an obsolete remnant of the days of the 80-column card. -- Dennis M. Ritchie