www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/10/15/09:46:41

Xref: news-dnh.mv.net comp.os.msdos.djgpp:2667
Path: news-dnh.mv.net!mv!news.sprintlink.net!hookup!usenet.eel.ufl.edu!newsfeed.internetmci.com!news.msfc.nasa.gov!elroy.jpl.nasa.gov!decwrl!genmagic!goonsquad.spies.com!uuwest!alcyone!max
From: max AT alcyone DOT darkside DOT com (Erik Max Francis)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: CTYPE Functions
Date: Fri, 13 Oct 95 14:18:51 PDT
References: <mictaliDGEBp5 DOT KB4 AT netcom DOT com>
Organization: &tSftDotIotE
Lines: 23
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

mictali AT netcom DOT com (Jere McDevitt) writes:

> My question is "Is this the proper behavior for isprint? Afterall, 0x121
> isn't >= 0x20 && <= 0x7e, so why does it return true?"

ANSI C, 7.3:

    The header <ctype.h> declares several functions useful for testing 
    and mapping characters.  In all cases the argument is an int, the 
    value of which shall be representable as an unsigned char or shall 
    equal the value of the macro EOF.  If the argument has any other 
    value, the behavior is undefined.

Since 0x121 is not representable by an unsigned char under DJGPP, 
you're completely at the mercy of the compiler.  In this particular 
case, it appears that DJGPP chooses the more efficient operation (not 
bothering to bound the check above by 0x100).


Erik Max Francis, &tSftDotIotE // uuwest!alcyone!max, max AT alcyone DOT darkside DOT com
San Jose, CA, USA // 37 20 07 N  121 53 38 W // GIGO, Omega, Psi // the 4th R!
H.3`S,3,P,3$S,#$Q,C`Q,3,P,3$S,#$Q,3`Q,3,P,C$Q,#(Q.#`-"C`- // 1love // folasade
_Omnia quia sunt, lumina sunt._ // mc2? oo?  Nah. // http://www.spies.com/max/

- Raw text -


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