What is the macro definition of isupper in C?(C语言中isupper的宏定义是什么?)
问题描述
我想知道isupper"宏是如何在 C/C++ 中定义的.能否请您提供相同的信息或指向我可用的资源.我尝试查看 ctype.h 但无法弄清楚.
I want to know how the "isupper" macro is defined in C/C++. Could you please provide me the same or point me to available resources. I tried looking at ctype.h but couldnt figure it out.
推荐答案
它是由实现定义的——每个供应商都可以而且通常会以不同的方式来做.
It's implementation defined -- every vendor can, and usually does, do it differently.
最常见的通常涉及特征"表 - 每个字符都有一个元素的数组,该元素的值是一组标志,表示有关字符的详细信息.一个例子是:
The most common usually involves a "traits" table - an array with one element for each character, the value of that element being a collection of flags indicates details about the character. An example would be:
traits[(int) 'C'] = ALPHA | UPPER | PRINTABLE;
在这种情况下,isupper() 将类似于:
In which case,, isupper() would be something like:
#define isupper(c) ((traits[(int)(c)] & UPPER) == UPPER)
这篇关于C语言中isupper的宏定义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:C语言中isupper的宏定义是什么?
基础教程推荐
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- CString 到 char* 2021-01-01
