isascii() error

Z

Zach

ll13.c:104: warning: implicit declaration of function 'isascii'
ll13.c:104: warning: nested extern declaration of 'isascii'

ll13.c:104 if (isascii(p[0]))

Oddly enough I was using isblank() before I changed it to isascii() in
that statement and there was no error!
I have "#include <ctype.h>" so I don't understand this error. How can
I fix this?

Zach
 
D

Default User

Zach said:
ll13.c:104: warning: implicit declaration of function 'isascii'
ll13.c:104: warning: nested extern declaration of 'isascii'

ll13.c:104 if (isascii(p[0]))

Oddly enough I was using isblank() before I changed it to isascii() in
that statement and there was no error!
I have "#include <ctype.h>" so I don't understand this error. How can
I fix this?

That's not a standard C function. Your compiler setting may be preventing
extensions to standard C headers like ctype.h from including non-standard
functions. Why are you using it?



Brian
 
Z

Zach

That's not a standard C function. Your compiler setting may be preventing
extensions to standard C headers like ctype.h from including non-standard
functions. Why are you using it?

But gcc has no problem when I use other functions from ctype.h like
isblank(). I need to check if a character (looping through a string)
is valid or not. Before I was using "!isblank()" but isascii() seems
to recognize more characters. This is part of a function that counts
how many tokens are in a string.

Zach
 
K

Keith Thompson

Zach said:
But gcc has no problem when I use other functions from ctype.h like
isblank(). I need to check if a character (looping through a string)
is valid or not. Before I was using "!isblank()" but isascii() seems
to recognize more characters. This is part of a function that counts
how many tokens are in a string.

isblank() is standard. isascii() isn't.

You're probably telling gcc to operate in standard-conforming mode,
which means that isascii() isn't going to be visible. If you
really want to use it, you'll need to turn off whatever options
you're using that are causing gcc to disable it.

But again, why are you using isascii()? Since it returns true for
any 7-bit character that fits into the 7-bit ASCII character set,
*including the space character*, I doubt that it's going to be
useful for your purpose.
 
H

H Vlems

ll13.c:104: warning: implicit declaration of function 'isascii'
ll13.c:104: warning: nested extern declaration of 'isascii'

ll13.c:104 if (isascii(p[0]))

Oddly enough I was using isblank() before I changed it to isascii() in
that statement and there was no error!
I have "#include <ctype.h>" so I don't understand this error. How can
I fix this?

Zach

Is it possible you might have thought of isalnum() or isalpha()
instead?
Hans
 
Z

Zach

isblank() is standard.  isascii() isn't.

You're probably telling gcc to operate in standard-conforming mode,
which means that isascii() isn't going to be visible.  If you
really want to use it, you'll need to turn off whatever options
you're using that are causing gcc to disable it.

But again, why are you using isascii()?  Since it returns true for
any 7-bit character that fits into the 7-bit ASCII character set,
*including the space character*, I doubt that it's going to be
useful for your purpose.

Ah, thanks Ken. Will stick with isblank().

Zach
 
N

Nobody

You're probably telling gcc to operate in standard-conforming mode,
which means that isascii() isn't going to be visible. If you
really want to use it, you'll need to turn off whatever options
you're using that are causing gcc to disable it.

Normally, you'd just define the relevant feature-test macros. The
isascii(3) manpage says:

Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

isascii():
_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE

Or use _GNU_SOURCE, which enables all of these and then some. But
if you're using -ansi/-std=, you might be trying to avoid that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top