delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2013/06/26/04:00:36

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Rod Pemberton" <do_not_have AT notemailnotq DOT cpm>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: General Protection Fault error is intermittent
Date: Wed, 26 Jun 2013 03:45:55 -0400
Organization: Aioe.org NNTP Server
Lines: 57
Message-ID: <kqe5vl$jot$1@speranza.aioe.org>
References: <36e857f0-9899-496b-9fc6-32251e109888 AT googlegroups DOT com> <kpo3gh$4qo$1 AT speranza DOT aioe DOT org> <858cbded-7989-46e6-a997-93f842cdb3b0 AT googlegroups DOT com> <kq75ni$qvf$1 AT speranza DOT aioe DOT org> <020e0244-406c-4c1f-9dbc-d82a0fae976f AT googlegroups DOT com>
NNTP-Posting-Host: CNsg4fVcCsvs3UaOgZtQCw.user.speranza.aioe.org
X-Complaints-To: abuse AT aioe DOT org
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.2001
X-Notice: Filtered by postfilter v. 0.8.2
X-Newsreader: Microsoft Outlook Express 6.00.2800.2001
X-Priority: 3
X-MSMail-Priority: Normal
Bytes: 2720
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"K.J.Williams" <lordwilliams1972 AT gmail DOT com> wrote in message
news:020e0244-406c-4c1f-9dbc-d82a0fae976f AT googlegroups DOT com...
> On Sunday, June 23, 2013 8:54:27 AM UTC-7, Martin Str|mberg
wrote:
> > K.J.Williams <lordwilliams1972 AT gmail DOT com> wrote:
...

> BTW, I found another bug with DJGPP
>
> if you have program that just uses :
>
> #include<stdio.h>
> #include<string.h>
>
> ...and you use a function from ctype.h - as I did with isspace(),
> without including ctype.h in your includes ... DJGPP/GCC
> will NOT complain about it

It "complains" here.

However, you have to specify the '-Wall' parameter to gcc to get it
to "complain" in the first place.  Did I mention that previously?

You might consider using '-Wall -pedantic' at a minimum.  You can
use '-ansi' for C89/C90 code.

It sounds to me like you might be using the wrong function.  When
you want to detect non-printable characters, you probably want to
use isgraph() instead of isspace() etc.  Specifically, you probably
want the logical opposite of isgraph().  I.e.,

  if(!isgraph(c))
  {
        ....
  }

Or, you could use a small switch() statement to detect your own set
of characters.

You can also use isgraph() with isalnum() to create an ispunct()
etc.  Some systems return strange results for some of the isXXX()
set of functions, i.e., better to create your own from the "safe"
functions where everything is defined.

> ...Secondly, I found this strange, but some how the ANSI C
> or C++ standard doesn't consider the escape sequence '\b'
> (for backspace) as a white-space character when I use
> isspace() to check individual characters in a c-string.

Well, that's part of the standard.


Rod Pemberton




- Raw text -


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