Path: utzoo!mnetor!tmsoft!dptcdc!jarvis.csri.toronto.edu!mailrus!cornell!batcomputer!itsgw!steinmetz!uunet!auspex!guy From: guy@auspex.UUCP (Guy Harris) Newsgroups: comp.lang.c Subject: Re: Character constants Keywords: NULL Message-ID: <1113@auspex.UUCP> Date: 4 Mar 89 07:23:31 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> Reply-To: guy@auspex.UUCP (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 19 >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? Doug Gwyn indicated that one version of a C compiler delivered by one vendor decided that sizeof "this is a big fat string" was the same as sizeof (char *) which is simply not correct. Your simple test program may give the wrong answer if your compiler is buggy. It may be easier to execute a simple test program, but it may not be easier to believe the results of that program....