[TUHS] v7 K&R C

ron at ronnatalie.com ron at ronnatalie.com
Mon May 18 02:14:48 AEST 2020


It technically probably always should have.    Void* (which has the same
format as char*) would have accepted either type pointer, char* shouldn't,
though I suspect that early compilers that predate void* would have happily
converted any pointer to char* (or int for that matter).

-----Original Message-----
From: TUHS <tuhs-bounces at minnie.tuhs.org> On Behalf Of Derek Fawcus
Sent: Sunday, May 17, 2020 12:11 PM
To: tuhs at tuhs.org
Subject: Re: [TUHS] v7 K&R C

On Fri, May 15, 2020 at 10:31:38PM +0100, Richard Tobin wrote:
>   "The implementation shall define char to have the same range,
>   representation, and behavior as either signed char or unsigned char."
>   - C99
> 
> (Technically it's a separate type from both of them.)

I was about to suggest I'd yet to come across a compiler which handled them
that way, but on checking I find that both clang and gcc do now in effect
have 3 types.

i.e. both 'unsigned char *' and 'signed char *' values passed to a function
taking 'char *' raises a warning.

I wonder when they started doing that?

DF



More information about the TUHS mailing list