Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!dayton!meccts!viper!john From: john@viper.UUCP Newsgroups: comp.lang.c Subject: Re: Character types in ANSI C Message-ID: <564@viper.UUCP> Date: Sat, 21-Feb-87 15:36:12 EST Article-I.D.: viper.564 Posted: Sat Feb 21 15:36:12 1987 Date-Received: Sun, 22-Feb-87 05:39:04 EST References: <816@cullvax.UUCP> Reply-To: john@viper.UUCP (John Stanley) Organization: DynaSoft Systems Lines: 31 In article <816@cullvax.UUCP> drw@cullvax.UUCP (Dale Worley) writes: >cg@myrias.UUCP (Chris Gray) writes: >> I.e. which of the following are legal: >> >> char *p1; >> unsigned char *p2; >> signed char *p3; >> >> p1 = p2; /* case 1 */ >> p1 = p3; /* case 2 */ >> p2 = p3; /* case 3 */ > >Well, the char's are all widened into the 'appropriate' int types. >(These are called integral promotions, or some such.) Then the >appropriate comparisons of int's and/or unsigned int's are performed. > Wrong... Not chars Dale... Pointers. I suspect you just misread the defines. All three are assigning pointers between pointer variables. One of the cases (case 1 or 2 depending on the implementation) is legal. Case 3 is always illegal but will only be flagged as a warning and an implicit cast-to-the-appropriate-pointer-type will be done by some compilers... Also, there's no "comparisons" being done here at all. The "=" operation is an assignment. The "==" operation is compare for equal... --- John Stanley (john@viper.UUCP) Software Consultant - DynaSoft Systems UUCP: ...{amdahl,ihnp4,rutgers}!{meccts,dayton}!viper!john