Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - More 4.2.1 question:: (4 Items)
   
More 4.2.1 question:  
extern void allo(char *);

void foo(void)
{

        char achar[10];
        unsigned char auchar[10];

        allo ( achar );
        allo ( auchar );

}

qcc -V4.2.1,gcc_ntox86 -w9 -funsigned-char try.c
will give: "pointer targets in passing argument 1 of 'allo' differ in signedness" even though -funsigned-char is 
specified!

- Mario
Re: More 4.2.1 question:  
The C standard specifies (6.2.5/15 and note 35) that char, signed char and unsigned char are separate types. Regardless 
of which options you use, they are different types and the warnings are valid.

Regards,

Ryan Mansfield
Re: More 4.2.1 question:  
char is different with signed char?
Re: More 4.2.1 question:  
> char is different with signed char?

char is implementation defined (usually defined by the processor ABI) to have the same range and representation as 
either signed or unsigned char. The -funsigned-char and -fsigned-char options control the behavior of char. 

However, as Note 35 of the C standard says, "Irrespective of the choice made, char is a separate type from the other two
 and is not compatible with either."

People should be aware that using the -funsigned-char -fsigned-char options can break ABI compatibility, and the options
 exist to be a  crutch for legacy code that assumes char to be either signed or char. Portable code should assume 
neither.

Regards,

Ryan Mansfield