delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/09/22/13:43:42

From: benny AT crocodial DOT de (Benjamin Riefenstahl)
Subject: Re: some unusual errors
22 Sep 1998 13:43:42 -0700 :
Message-ID: <36077457.96F4F12E.cygnus.gnu-win32@crocodial.de>
References: <199809211655 DOT MAA13243 AT venus DOT solidum DOT com>
Mime-Version: 1.0
To: gnu-win32 AT cygnus DOT com

Hi Michael,


> >>>>> "Benjamin" == Benjamin Riefenstahl <benny AT crocodial DOT de> writes:
>     Benjamin>         ... isspace((unsigned char)*s); ...

Michael Richardson wrote:
>   Then the routines should cast the argument appropriately, or the routines
> should be functions and cast things appropriate, or "char" should be by
> default unsigned.

- By the definition of the interface, an internal cast is out of the
question (the interface is defined to handle EOF correctly and that
usually means handling it differently from '\xFF').
- You can replace the routines with functions in the RTL by #undefining
the macros, but that doesn't gain you anything here, negative char
values (except EOF) would still cause undefined behaviour (i.e. may
crash). OTOH the warning would go away, which I would consider a bad
thing, being that it hightlights a real problem, and the performance
would suffer.
- You can make char unsigned in gcc (-funsigned-char), but if you rely
on that in your code, it would be non-portable.

You're basically right, the defined interface is not as user friendly as
it pretends to be. Still it's the defined interface, and for the time
being neither you nor me can change the definition and changing a
particular implementation doesn't buy me enough to do it (I used to do
that, but nowadays I rather write portable code).


so long, benny
======================================
Benjamin Riefenstahl (benny AT crocodial DOT de)
Crocodial Communications EntwicklungsGmbH
Ruhrstraße 61, D-22761 Hamburg, Germany
-
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