Newsgroups: comp.lang.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: Character constants Message-ID: <1989Mar3.162905.16872@utzoo.uucp> Organization: U of Toronto Zoology 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> Date: Fri, 3 Mar 89 16:29:05 GMT In article <7447@pyr.gatech.EDU> curci@stat.fsu.edu (Ray Curci (scri)) writes: >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? Unfortunately, executing a test program just tells you what your compiler thinks the answer is. That doesn't mean it's right. Quite apart from compiler bugs, which definitely exist, there has been some divergence among C compilers over the years. It will be quite a while before all compilers comply with the ANSI standard, even in theory. -- The Earth is our mother; | Henry Spencer at U of Toronto Zoology our nine months are up. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu