Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > isascii() error

Reply
Thread Tools

isascii() error

 
 
Zach
Guest
Posts: n/a
 
      11-19-2010
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
 
Reply With Quote
 
 
 
 
Default User
Guest
Posts: n/a
 
      11-19-2010
"Zach" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
--
Day 652 of the "no grouchy usenet posts" project.
Current music playing: None.


 
Reply With Quote
 
 
 
 
Zach
Guest
Posts: n/a
 
      11-19-2010
On Nov 18, 7:13*pm, "Default User" <(E-Mail Removed)> wrote:
>
> 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
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      11-19-2010
Zach <(E-Mail Removed)> writes:
> On Nov 18, 7:13*pm, "Default User" <(E-Mail Removed)> wrote:
>> 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.


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.

--
Keith Thompson (The_Other_Keith) http://www.velocityreviews.com/forums/(E-Mail Removed) <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
H Vlems
Guest
Posts: n/a
 
      11-19-2010
On 19 nov, 01:01, Zach <(E-Mail Removed)> wrote:
> 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
 
Reply With Quote
 
Zach
Guest
Posts: n/a
 
      11-19-2010
On Nov 18, 8:04*pm, Keith Thompson <(E-Mail Removed)> wrote:
>
> 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
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      11-19-2010
Zach <(E-Mail Removed)> writes:
> On Nov 18, 8:04*pm, Keith Thompson <(E-Mail Removed)> wrote:
>>
>> 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().


You're welcome. Who's Ken?

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
Nobody
Guest
Posts: n/a
 
      11-19-2010
On Thu, 18 Nov 2010 17:04:36 -0800, Keith Thompson wrote:

> 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.

 
Reply With Quote
 
Zach
Guest
Posts: n/a
 
      11-27-2010
On Nov 19, 11:36*am, Keith Thompson <(E-Mail Removed)> wrote:
>
>
> You're welcome. *Who's Ken?


Sorry, must have been thinking of Ken Thompson

Zach










 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0xffc Thread 0x228 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 0 03-30-2006 03:16 PM
Error connecting to SQLExpress 2005 locally (error: 26 - Error Locating Server/Instance Specified) hfk0 ASP .Net 2 03-27-2006 08:43 PM
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x8fc Thread 0x934 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 1 03-24-2006 04:20 PM
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x8fc Thread 0x934 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 0 03-24-2006 02:22 PM
Error 500: ERROR: Cannot forward. Writer or Stream already obtained. Error JavaQueries Java 1 03-01-2005 06:30 PM



Advertisments