Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!quanta.eng.ohio-state.edu!sleepy.eng.ohio-state.edu!rob From: rob@sleepy.eng.ohio-state.edu (Rob Carriere) Newsgroups: comp.lang.c Subject: Re: Character constants Keywords: NULL Message-ID: <1586@quanta.eng.ohio-state.edu> Date: 3 Mar 89 01:40:45 GMT References: <13068@steinmetz.ge.com> <102@servio.UUCP> <10138@socslgw.csl.sony.JUNET> <1783@dlvax2.datlog.co.uk> <217@skye.ed.ac.uk> <7447@pyr.gatech.EDU> Sender: news@quanta.eng.ohio-state.edu Reply-To: rob@sleepy.eng.ohio-state.edu (Rob Carriere) Organization: Ohio State Univ, College of Engineering Lines: 22 In article <7447@pyr.gatech.EDU> curci@stat.fsu.edu (Ray Curci (scri)) writes: >Why is therer so much discussion about character discussions? > >A simple printf("%d", sizeof('x') ); reveals that a character constant >(at least both on sun3 and ultrix 11/780) are the same as an int (4 chars). >Isn't it a lot easier to execute a simple test program than to try to >look up this type of information? Yes, it is (usually) much easier. Yes, you should do it, *to test your compiler*. No, it does not answer the question. A compiler does not a language definition make. Secondly, your test here is insufficient. For example, the computer that is currently bearing with me chattering all over the place will, on request, also happily provide the information that sizeof(long) == sizeof(float) The assumption that this would mean that the types long and float are the same seems rather unsafe. SR