Talk:C character classification

Latest comment: 1 year ago by PrimeBOT in topic India Education Program course assignment

{{Talk header]]

Untitled

edit

I don't think C source code listing is appropriate for any encyclopedia article. Why not cut out the "Implementation" section, and rather include an external link to a website with the code? Chitu 19:12, 13 May 2004 (UTC)Reply

I disagree. This entire article (including the source code) might be lost on someone with no computer science experience, but for someone who has done some programming but is not familiar with the particular problem ctype.h is designed to fix, seeing some example source can make a huge difference in readability. Count me in this group; I think it should stay. CyborgTosser 01:59, 31 Aug 2004 (UTC)

SCO v. IBM

edit

Erm... There is no such thing as a "Linus Torvalds's kernel mailing list post below" in the article... Medinoc 09:24, 16 May 2007 (UTC)Reply

Cast arguments

edit

>> The correct way to use char arguments is to first cast them to unsigned char.

This is incorrect. If the argument is representable in an unsigned char, then it is a non-negative number, this is what "representable in an unsigned char" means, so conversion to int type will not make it negative or change the bit pattern in any way. —Preceding unsigned comment added by Velco (talkcontribs) 18:20, 2 November 2008 (UTC)Reply

I agree that *after* one casts a char to an unsigned char, then it is a non-negative number "representable in an unsigned char", and further conversion to int type will not make it negative.
I don't see how that makes "first cast char arguments to unsigned char" incorrect. For example:
#include <stdio.h>
#include <ctype.h>

int main(void) {
    signed char c;
    printf("%s", "Type a letter.\n");
    c = getchar();
    if( isupper( (unsigned char) c ) ){
        printf("%s", "Uppercase! YAY!\n");
    }else{
        printf("%s", "not uppercase.\n");
    };
    return 0;
}

seems correct to me. Or is there something that needs to be fixed? Leaving out that (unsigned char) cast

    ...
    if( isupper( c ) ){ // incorrect
    ...

seems incorrect to me, as it could potentially pass a negative integer to isupper(). --68.0.124.33 (talk) 20:23, 6 March 2009 (UTC)Reply


Casting to unsigned char means you don't correctly consider EOF. I believe the safest method is to first check for EOF, and then cast to unsigned char. I'll update this on the page as well. Kasterma (talk) 13:22, 6 July 2011 (UTC)Reply

Move discussion in progress

edit

There is a move discussion in progress which affects this page. Please participate at Talk:C standard library - Requested move and not in this talk page section. Thank you. —RM bot 09:40, 8 November 2011 (UTC)Reply

International character support

edit

It is not clear if this library intend to addressee i18n (internationalisation) issues such as ISO-2022 or its Unicode concurrent. Which one does C support best?

It is not clear how C character classification should be considered in regard to the single byte character vs multiple byte vs wide character context.

Also: Is there any classification for the Byte Order Mark? — Preceding unsigned comment added by 84.97.14.22 (talk) 20:01, 22 July 2012 (UTC)Reply

India Education Program course assignment

edit

  This article was the subject of an educational assignment supported by Wikipedia Ambassadors through the India Education Program.

The above message was substituted from {{IEP assignment}} by PrimeBOT (talk) on 19:56, 1 February 2023 (UTC)Reply