delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/21/12:59:44

From: Hans-Bernhard Broeker <broeker AT acp3bf DOT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: signed - unsigned chars
Date: 21 Jan 2000 14:42:05 GMT
Organization: Aachen University of Technology (RWTH)
Lines: 25
Message-ID: <869r7t$j4d$1@nets3.rz.RWTH-Aachen.DE>
References: <000701bf63ef$41a61440$0307028a AT prmivv03>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 948465725 19597 137.226.32.75 (21 Jan 2000 14:42:05 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 21 Jan 2000 14:42:05 GMT
User-Agent: tin/1.4-19991113 ("No Labels") (UNIX) (Linux/2.0.0 (i586))
Originator: broeker@
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Petr Maxa <maxa AT sse-za DOT sk> wrote:

> I am working on a project, where is very important to have all chars as
> unsigned types. 

Bad coding in that project, then. If they had to have unsigned chars,
they should have *coded* unsigned chars, not rely on some compiler
switch to automagically do it for them...

> There is now a problem to accomplish this, as compiler
> treats constant chars as signed types. 

Hmm... 'constant chars' can mean one of two things: character
constants like 'A', or variables of type 'const char'. For the former,
note that the language definition itself (ANSI C standard) leaves you
no choice there: all (non-wide) character constants are of the signed
type _int_, by definition.

There is an option -funsigned-char for gcc, but I wouldn't bet on it
solving all your problems. That might need a library rebuild with that
flag active, or even a massive library overhaul.

-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019