Path: utzoo!attcan!uunet!ncrlnk!ncrcae!hubcap!gatech!uflorida!novavax!twwells!bill From: bill@twwells.uucp (T. William Wells) Newsgroups: comp.lang.c Subject: Re: type of character constants Keywords: character constants Message-ID: <766@twwells.uucp> Date: 11 Mar 89 11:34:21 GMT References: <13068@steinmetz.ge.com> <102@servio.UUCP> <10138@socslgw.csl.sony.JUNET> <1783@dlvax2.datlog.co.uk> <3711@xyzzy.UUCP> <1644@vicorp.UUCP> Reply-To: bill@twwells.UUCP (T. William Wells) Organization: None, Ft. Lauderdale Lines: 21 Summary: Expires: Sender: Followup-To: Distribution: In article <1644@vicorp.UUCP> charlie@vicorp.UUCP (Charlie Goldensher) writes: : So what does it matter if a character constant is of type char or of : type int? If it is of type char, it will be *converted* to type int : in any expression in which it is used. And if it is of type int it : will be implicitly cast to type char if it assigned to a variable of : type char. : : I don't care how the compiler writer chooses to implement it internally : as long as they follow the appropriate conversion rules. : : Is there some reason I *should* care? There is a subtle difference. If 'c' is an integer constant, '\377' represents the value 255. If, on the other hand, it is a char constant, and characters sign extend, it represents -1. --- Bill { uunet | novavax } !twwells!bill (BTW, I'm going to be looking for a new job sometime in the next few months. If you know of a good one, do send me e-mail.)