What's the default type in AIX between signed and unsigned char ?

What's the default type in AIX between signed and unsigned char ?

Post by Seung-Hoon Le » Fri, 08 Dec 2000 11:50:19



Hi AIX users ??

I made a simple application that is working on AIX machine. It's very
simple.
In my source, I used the variables of char , signed char and unsigned char
type.
For example:

 main ()
{
      char a;
      signed char b:
     unsigned char c:

    a = -1;
   b = -1;
   c = -1;

   printf (" %d %d %d\n", a, b, c);

Quote:}

The result is :

$ 255  -1  255

Looking for the above result, In this case, I found char type is unsigned
char type defaultly.
For Integer variable, I did the same test. The result was same.

Is it right char type is unsigned char type in AIX machine ?

 
 
 

What's the default type in AIX between signed and unsigned char ?

Post by Werne » Fri, 08 Dec 2000 12:17:42


ANSI doesn't specify whether char is signed or unsigned by default.
The Sun and SVR4/386 C compiler make signed char the default.
The AIX C compiler makes unsigned char the default.

Werner


> Hi AIX users ??

> I made a simple application that is working on AIX machine. It's very
> simple.
> In my source, I used the variables of char , signed char and unsigned char
> type.
> For example:

>  main ()
> {
>       char a;
>       signed char b:
>      unsigned char c:

>     a = -1;
>    b = -1;
>    c = -1;

>    printf (" %d %d %d\n", a, b, c);

> }

> The result is :

> $ 255  -1  255

> Looking for the above result, In this case, I found char type is unsigned
> char type defaultly.
> For Integer variable, I did the same test. The result was same.

> Is it right char type is unsigned char type in AIX machine ?


 
 
 

What's the default type in AIX between signed and unsigned char ?

Post by Joerg Brueh » Fri, 08 Dec 2000 04:00:00


Hi !


> [...]

> Is it right char type is unsigned char type in AIX machine ?

AFAIK: Yes, unless you give the compiler option "chars=signed"
either on the command line or in the configuration file
'/etc/xlC.cfg'.

HTH,
Joerg Bruehe

--
Joerg Bruehe, SQL Datenbanksysteme GmbH, Berlin, Germany
     (speaking only for himself)

 
 
 

1. Sparcworks C/C++: unsigned char vs signed char

Does anyone know of a way I can tell the Sparcworks compiler to make all
'chars' unsigned instead of signed (like the -funsigned-char flag under
the GNU C compiler)? I have a whole bunch of code that already exists that
expect char's to be unsigned but just declare variables as 'char'. Else
is there a portable way of using typedef's + #defines to trick the compiler?

thanks,
mahesh

2. Asynchronous threadsafe DNS library

3. pointer of 'unsigned char' == 'char'!?

4. I have 500 error,why?

5. Possible bug in cc involving signed/unsigned chars

6. Advantest Memory Test Systems?

7. Making unsigned chars the default

8. problem installing IntelEtherExpress Pro10

9. Why is unsigned char the default in xlc?

10. How can I read 6-bit words from an 'unsigned char' array?

11. Lint doesn't catch signed => unsigned arg passing

12. Sun Workshop C Compiler ("char" as "unsigned char") ?

13. unsigned char to a char* conversion ?