isascii() error

Discussion in 'C Programming' started by Zach, Nov 19, 2010.

  1. Zach

    Zach Guest

    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
     
    Zach, Nov 19, 2010
    #1
    1. Advertising

  2. Zach

    Default User Guest

    "Zach" <> wrote in message
    news:...
    > 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.
     
    Default User, Nov 19, 2010
    #2
    1. Advertising

  3. Zach

    Zach Guest

    On Nov 18, 7:13 pm, "Default User" <> 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
     
    Zach, Nov 19, 2010
    #3
  4. Zach <> writes:
    > On Nov 18, 7:13 pm, "Default User" <> 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.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Nov 19, 2010
    #4
  5. Zach

    H Vlems Guest

    On 19 nov, 01:01, Zach <> 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
     
    H Vlems, Nov 19, 2010
    #5
  6. Zach

    Zach Guest

    On Nov 18, 8:04 pm, Keith Thompson <> 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
     
    Zach, Nov 19, 2010
    #6
  7. Zach <> writes:
    > On Nov 18, 8:04 pm, Keith Thompson <> 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) <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"
     
    Keith Thompson, Nov 19, 2010
    #7
  8. Zach

    Nobody Guest

    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.
     
    Nobody, Nov 19, 2010
    #8
  9. Zach

    Zach Guest

    On Nov 19, 11:36 am, Keith Thompson <> wrote:
    >
    >
    > You're welcome.  Who's Ken?


    Sorry, must have been thinking of Ken Thompson ;-)

    Zach
     
    Zach, Nov 27, 2010
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hfk0
    Replies:
    2
    Views:
    21,678
  2. JavaQueries
    Replies:
    1
    Views:
    3,679
    John C. Bollinger
    Mar 1, 2005
  3. Balaji
    Replies:
    3
    Views:
    10,116
  4. Bishop
    Replies:
    1
    Views:
    792
    Bishop
    Feb 24, 2007
  5. juvi
    Replies:
    3
    Views:
    1,054
    Alexey Smirnov
    Jan 22, 2009
Loading...

Share This Page