delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/09/15:47:29

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: domain of isspace()?
Date: Tue, 06 May 1997 23:09:48 -0700
Organization: Alcyone Systems
Lines: 21
Message-ID: <33701CAC.7DE8FB9E@alcyone.com>
References: <33711D51 DOT 430E AT geocities DOT com> <336FBFF9 DOT 63AF AT cs DOT com>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

John M. Aldrich wrote:

> In DJGPP, the ctype functions evaluate to a lookup of an array of
> flags.  You are perfectly safe to call them with any valid char value.

Right.  I should point out that the ctype.h is... functions take an int,
but the ANSI C standard (7.3, Character handling <ctype.h>) states that
it's only valid to call them with an unsigned char value or EOF.

So if you call isspace(-2) or isspace(23523), you're likely to have a
problem -- this is because, as you say, the ctype functions are
implemented as a lookup table, and looking up something other than -1 ..
255 would be a bad thing.

-- 
       Erik Max Francis, &tSftDotIotE / email / max AT alcyone DOT com
                     Alcyone Systems /   web / http://www.alcyone.com/max/
San Jose, California, United States /  icbm / 37 20 07 N  121 53 38 W
                                   \
                      "The future / is right there."
                                 / Bill Moyers

- Raw text -


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