Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Jun 1997 01:29:25 +1000
From:      David Nugent <davidn@labs.usn.blaze.net.au>
To:        Michael Smith <msmith@atrad.adelaide.edu.au>
Cc:        un_x@anchorage.net (Steve Howe), hackers@FreeBSD.ORG
Subject:   Re: signed/unsigned cpp 
Message-ID:  <199706021529.BAA00871@labs.usn.blaze.net.au>
In-Reply-To: Your message of "Mon, 02 Jun 1997 17:37:51 %2B0930." <199706020807.RAA20786@genesis.atrad.adelaide.edu.au> 

next in thread | previous in thread | raw e-mail | index | archive | help
>  > > Because neither is equivalent to the "default" signedness.
>  > > 
>  > > const char * is _not_ equivalent to const unsigned char *, or const
>  > > signed char *.
>  > 
>  > i would appreciate it if you could explain further - why?
>  > any char * can _only_ be signed or unsigned, even if it's
>  > the default that makes it so. ?
>  
>  'char' has three types of signedness; "signed", "unsigned" and "default".
>  
>  Signed and unsigned are obvious.  Default means "use whatever is the default
>  on this platform".  Thus, for portable code signed != unsigned != default.

It isn't only a portability issue, but also a c++ standards issue.
c++ distinguishes between these three types. Ansi c only has two
and there it *is* a portability issue as to whether char* is signed
or unsigned. This is one of the many ambiguities that c++ has the
luxury to resolve. :)

Regards,
David

David Nugent - Unique Computing Pty Ltd - Melbourne, Australia
Voice +61-3-9791-9547  Data/BBS +61-3-9792-3507  3:632/348@fidonet
davidn@freebsd.org davidn@blaze.net.au http://www.blaze.net.au/~davidn/




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199706021529.BAA00871>