Reputation: 4918
I am developing a test software where the user can enter a string where I must validate it as C++ variable syntax. Then I started wondering if people can develop in japanese or other idioms.
When I typed "is" on some IDE, it poped up a list with a "isascii" function. Then I wondered if I can use that function to check for the letters of the variable.
I googled and couldn't find about isascii if not on microsoft's msdn, so I guess its a windows function that use the locale of the machine?
could someone also explain a bit of this isascii and __isascii please?
edit: what of this "is" functions should I use to check for the letter that is in the name of the variable?
Thanks and sorry my nooberish!
Joe
Upvotes: 2
Views: 300
Reputation:
The C standard doesn't consider letters that are not contained in ASCII as letters. Thus I don't think C supports characters other than [c=='_' isalpha()][c=='_' isalnum()]* for symbol names, even though other programming languages do. So you should check for that.
Upvotes: 0
Reputation: 202615
You can find out about character classification, including isascii
, by looking at the man page. Which characters are considered letters (and so on) is determined by your "locale". I confess I always find locale settings confusing...
Upvotes: 0
Reputation: 45105
I think you might find this article by Joel Spolsky helpful, if you're interested in writing software that can deal gracefully with international languages and character sets:
Edit: Upon closer reading of your question, it seems you are more interested in
whether international characters are valid to use in your C or C++ source code.
Yes, this is possible.
Upvotes: 2