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

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

Post by Volker Dormeye » Sun, 27 Jun 1999 04:00:00



Hi,

We use the Sun Workshop C Compiler (sorry, I dont know the version
cause Im not at the box, yet) on
SunOS 5.5 and 5.6.

Is there a way to handle a plain "char" datatype as "unsigned char" via
command line option?
I watched out for a compiler flag in the man pages and in online help,
but I havent found anything.

Does anybody know about such compiler option?
Thanks!!!

-Volker-

--
################################
 sender: Volker Dormeyer

################################

 
 
 

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

Post by Steve Bellen » Sun, 27 Jun 1999 04:00:00




Quote:>Hi,

>We use the Sun Workshop C Compiler (sorry, I dont know the version
>cause Im not at the box, yet) on
>SunOS 5.5 and 5.6.

>Is there a way to handle a plain "char" datatype as "unsigned char" via
>command line option?
>I watched out for a compiler flag in the man pages and in online help,
>but I havent found anything.

>Does anybody know about such compiler option?

I doubt it. Why would you want to do this? It will likely break many
library calls. (do chars get promoted to unsigned chars or is it
the reverse?)

The char has the same bit pattern when signed or unsigned. Arithmetic
is a bit different, but it is usually not an issue. Java doesn't even
have an unsigned type.
--


 
 
 

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

Post by Kjetil Torgrim Homm » Sun, 27 Jun 1999 04:00:00


[Steve Bellenot]

Quote:>   I doubt it. Why would you want to do this? It will likely break
>   many library calls. (do chars get promoted to unsigned chars or is
>   it the reverse?)

If you're using an 8-bit character set, it is very useful.  You can
have a char *, and use the values therein to do array lookups.  If you
write unsigned char *, you'll get lots of warnings since all the C
library functions use just "char *".  It saves you a lot of casting.

GCC has an option for this,  -funsigned-char, I think.

Kjetil T.

 
 
 

1. Type "(", ")" and "{", "}" in X...

Hi,

When i start a shell under X, i can type all characters on my keyboard,
the same when i start the simple editor, but when i start Forte (Java
IDE) written in Java i cant use the "(", ")", "{", "}" and allmost none
of the characters that are located on the same key as a number...

Does anybody have an idea what i can do about that... could it be
something with programs written in Java..?

Mvg,
Erwin

Sent via Deja.com http://www.deja.com/
Before you buy.

2. How to know pending connections on a socket?

3. GETSERVBYNAME()????????????????????"""""""""""""

4. need help please!!!!!

5. """"""""My SoundBlast 16 pnp isn't up yet""""""""""""

6. some backup question

7. Help: use SED to move or replace "New-line" & "return" char

8. X-Term setup help

9. How to get "cin >> char" not to need "Enter"?

10. "ksh"/"bash" with wide-char support ?

11. "-O" or "-xO3" for optimization with Sun C++ Compiler

12. drivers/char/Kconfig:640: can't open file "drivers/char/ipmi/Kconfig"