Mail Archives: djgpp/2013/06/26/04:00:36
"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 -