Character types in ANSI C
meissner at dg_rtp.UUCP
meissner at dg_rtp.UUCP
Sun Mar 1 05:55:29 AEST 1987
In article <816 at cullvax.UUCP> drw at cullvax.UUCP (Dale Worley) writes:
> cg at 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.
Ughh, the above example is assigning pointers, not the items pointed
to. Assigning pointers to different types (modulo const/volatile) is
illegal in ANSI. Widening has nothing to do with it.
--
Michael Meissner, Data General Uucp: ...mcnc!rti-sel!dg_rtp!meissner
It is 11pm, do you know what your sendmail and uucico are doing?
More information about the Comp.lang.c
mailing list