delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/29/08:37:47

From: Roman Suzi <nuser AT rsuzi DOT pgu DOT karelia DOT ru>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: [Q]: unsigned char
Date: Wed, 29 Oct 97 09:55:42 +0300
Distribution: su
Organization: unknown
Message-ID: <ABktjLqSgI@rsuzi.pgu.karelia.ru>
Sender: news-service AT sampo DOT karelia DOT ru
Reply-To: nuser AT rsuzi DOT pgu DOT karelia DOT ru
Lines: 71
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

hi!

Eli Zaretskii wrote:
>On Mon, 27 Oct 1997, Vik Heyndrickx wrote:
>
>> You are right. Relying on the default setting of -fsigned-char or
>> -funsigned-char is dangerous. But '\xFD' should be positive when
>> compiled with -funsigned-char. I tested this and it also *is*. So either
>> Roman Suzi must use an older buggy compiler or he is using a defective
>> pgcc or I am missing something.

   I got latest version of DJGPP only 1 month ago! Or are there bugs
in RHIDE 1.1?
Because when I manually add -funsigned-char,
it works. (In contrast to when I use -funsigned-char
checkbox in RHIDE in Options/Compilers/C-flags)

>I think you are missing the fact that '\xFD' is NOT a character constant,
>it's an int.  Therefore, -funsigned-char doesn't affect it.

   NO!!! It has sizeof('\xFD') == 1

I have just checked it.
That is, it is char all right!


>You are right. Relying on the default setting of -fsigned-char or
>-funsigned-char is dangerous. But '\xFD' should be positive when
>compiled with -funsigned-char. I tested this and it also *is*. So either
>Roman Suzi must use an older buggy compiler or he is using a defective
>pgcc or I am missing something.
   Possibly, the fact, that my file is probe.cc
and not probe.c ?

That is, its C++ and -funsigned-char is C-flag.

(It is only silly suggestion. I am only beginner with
DJGPP/Rhide to understand all things in details)

>If you want avoid trouble always use explicit casts in these cases.
 --  Then the program will be a nightmare...

OK. I can use:

#define UC (unsigned char)

..

c = UC'\xFD'


No problem here.



Sincerely yours, Roman








--
 --               *                            --
--  Roman A. Suzi * Petrozavodsk Karelia Russia --
 --    http://www.angelfire.com/ks/sudensivu   --



- Raw text -


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