isspace(0)

Discussion in 'C Programming' started by Ian Pilcher, Jan 13, 2014.

  1. Ian Pilcher

    Ian Pilcher Guest

    Ian Pilcher, Jan 13, 2014
    #1
    1. Advertisements

  2. Ian Pilcher

    James Kuyper Guest

    6.4p3 defines what "white space characters" are; and that definition is
    not locale-specific. However, except in the "C" locale, isspace()
    returning true does NOT mean that its argument is a white space
    character. It is allowed to also return true for a locale-specific set
    of other characters, so long as they meet certain requirements. When a C
    standard library function is supposed to use isspace() rather than 6.4p3
    to determine whether to treat something as white space, the standard
    always says so explicitly (7.21.6.2p8, 7.22.1.3p2, 7.22.1.4p2). This
    might be a defect in the standard - I had expected to find many more
    such citations than just those 3.

    Tracing back, any additional character for which isspace() is true must
    also be one for which islower(), isupper(), and isdigit() are all false
    - which is certainly permitted for '\0'. I couldn't find anything
    forbidding it - but I may be missing something.

    Eric Sossman's message in that discussion is correct: "a locale-specific
    set of characters" doesn't not mean the same thing as "a set of
    locale-specific characters".
     
    James Kuyper, Jan 13, 2014
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.