delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/09/22/20:21:57

From: lat AT iki DOT fi (Lassi A. Tuura)
Subject: Re: some unusual errors
22 Sep 1998 20:21:57 -0700 :
Message-ID: <Pine.HPP.3.95a.980922142047.26309C-100000.cygnus.gnu-win32@hpatl20.cern.ch>
References: <199809211652 DOT MAA13143 AT venus DOT solidum DOT com>
Reply-To: "Lassi A. Tuura" <lat AT iki DOT fi>
Mime-Version: 1.0
To: Michael Richardson <mcr AT solidum DOT com>
Cc: Michael Hirmke <mh AT mike DOT franken DOT de>, gnu-win32 AT cygnus DOT com

|>   Why would you say "unsigned char"??
|>   It says "int" to me.
|>   So, a signed char should promote to int just fine.

The only negative value allowed with these functions is EOF (if it is
negative)---see the quotes earlier in this thread.  If you have a signed
character that really is negative, it will promote to a negative integer
and you end up with undefined behaviour. gcc is nice enough to give you
a warning about that.  You need to cast the character to `unsigned char'
before using it in the is* predicates.

Cheers,
//lat
--
With sufficient thrust, pigs fly just fine.  However, this is not
necessarily a good idea.  It is hard to be sure where they are going
to land, and it could be dangerous sitting under them as they fly
overhead.  --RFC1925, "The Twelve Networking Truths"

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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