Without testing, I think that a signed char argument satisfies and unsigned 
char formal parameter, but that &signed char does not satisfy unsigned char *.

There is some C messiness around char signage. I think on most platforms char 
is kind of the same as signed char, but not exactly the same. On Z a char is 
kind of the same as an unsigned char, but not exactly the same. I am obviously 
fuzzy on the exact details, and no doubt someone will be happy to set me 
straight.

Charles


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Paul Gilmartin
Sent: Sunday, April 26, 2020 2:14 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: XL C\C ++ sizeof of datatypes

On Sun, 26 Apr 2020 12:58:57 -0700, Charles Mills wrote:

>+1
>
>Or RTFKC:
>https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.cbclx01/zos_supporting_ansi_iso_standards.htm
>
Where I read:

Equivalent type of char: signed char, unsigned char, or user-defined:
    The default for char is unsigned

My experience, long ago, is that these are distinct types: C/C++ reported
a syntax error for formal parameter (char *), actual parameter (unsigned
char * ).  It's not what it means; it's what it's called.

Sequence of white-space characters (excluding the new-line):
    Any spaces or comments in the source program are interpreted as one space.

This may have some contention with historic use of comments as concatenators.
E.g. something like writing foo/* */bar for foobar.

The result of converting an integer from a shorter signed integer:
    The lowest 2 bytes of the integer are used to represent the short int.

??? I'd expect sign extension.  But wasn't there a transition from
unsigned-preserving to value-preserving.  E.g.:
    K&R:  -1 > (unsigned) 0
    ANSI: -1 < (unsigned) 0

CDC (not IBM) 3600 and earlier 1604 were wretched hybrids.  Numeric
arithmetic was 1's complement; addressing arithmetic was 2's complement.
And CDC 6600 had no compare instruction.  FORTRAN compared integers
by subtracting (hardware didn't report overflow) and testing the sign of
the result.

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to