Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ukma!rutgers!mcnc!rti!xyzzy!agarn!throopw From: throopw@agarn.dg.com (Wayne A. Throop) Newsgroups: comp.lang.c Subject: type of character constants Message-ID: <3711@xyzzy.UUCP> Date: 1 Mar 89 19:42:52 GMT References: <13068@steinmetz.ge.com> <102@servio.UUCP> <10138@socslgw.csl.sony.JUNET> <1783@dlvax2.datlog.co.uk> Sender: usenet@xyzzy.UUCP Lines: 31 > scm@datlog.co.uk ( Steve Mawer ) >> diamond@diamond. (Norman Diamond) >> When you assign 'x' to a character, you are assigning an int to a >> character. The reader knows that the type mismatch was intentional. > Not if he knows the C language. A single character written within > single quotes is a *character constant*. This isn't an int. Ha. A lot Steve knows. From K&R, 1st ed, pg 185 Character constants have type int; floating constants are double. From Harbison and Steele, page 19 Character constants have type int. From the latest dpANS C standard I have, 3.1.3.4, first sentence under "semantics": An integer character constant has type int. Strangely, I can't tell what type character constants have by reading K&RII. The references lead off to a note saying something like "... and all constants have some type, see section mumble about types". Section mumble talks about types alright, but nowhere does anything I can find state just what constant forms have what types. I wonder if I'm missing something, or if this is a little oversight? -- You will not see a monster {at Loch Ness}, just as millions before you have not. --- Charles Kuralt Wayne Throop !mcnc!rti!xyzzy!throopw