#define TRUE 1u

iceman417 2010-09-20 10:46:44
#define TRUE 1u 后面的1u,其中u代表什么啊?我是在ucos代码中看到的。
...全文
536 19 打赏 收藏 转发到动态 举报
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
wenjinghuan999 2011-07-24
  • 打赏
  • 举报
回复
无符号整数,像100l就是长整型
FrankHB1989 2011-07-24
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 zhao4zhong1 的回复:]

C++ Integer Constants
Integer constants are constant data elements that have no fractional parts or exponents. They always begin with a digit. You can specify integer constants in decimal, octal, or……
[/Quote]
抄MDSN的lagecy manual?
科普:integer constant的说法在ISO C里有正式定义。对应在ISO C++里叫integer literal。
stein42 2011-07-24
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 schoolers 的回复:]

无符号整数unsigned

类似的有s(hort),l(ong),f(loat)...
[/Quote]

“s”后缀无效
xiafeng1113 2011-07-24
  • 打赏
  • 举报
回复
不是8位的吧,我经常见左移14位等
泡泡 2010-09-21
  • 打赏
  • 举报
回复
慢慢来,加油
Q446512799 2010-09-21
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 iceman417 的回复:]
知之为知之,不知为不知。是知也。 只要我不知道的我就问。
[/Quote]
勤学好问
小魔菇 2010-09-21
  • 打赏
  • 举报
回复
见过就熟悉了 都是这样过来的
请5楼不要BS新人
wangtea 2010-09-21
  • 打赏
  • 举报
回复
是不是代表unsigned
iceman417 2010-09-20
  • 打赏
  • 举报
回复
知之为知之,不知为不知。是知也。 只要我不知道的我就问。
乐CC 2010-09-20
  • 打赏
  • 举报
回复
看到楼主我真的无语了.
ayw215 2010-09-20
  • 打赏
  • 举报
回复
无符号整数
vysnow 2010-09-20
  • 打赏
  • 举报
回复
unsigned
hai040 2010-09-20
  • 打赏
  • 举报
回复
unsigned
类似的有s(hort),l(ong),f(loat)...
Csuxiaowu 2010-09-20
  • 打赏
  • 举报
回复
无符号吧
jerry008008 2010-09-20
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 sky198306 的回复:]

基础知识不熟,现在的我也一样
[/Quote] 我也是啊
某某9 2010-09-20
  • 打赏
  • 举报
回复
无符号整数unsigned

类似的有s(hort),l(ong),f(loat)...
sky198306 2010-09-20
  • 打赏
  • 举报
回复
基础知识不熟,现在的我也一样
fujye 2010-09-20
  • 打赏
  • 举报
回复
都是白过来的。。。我知道这种写法也才两天。。。哈哈。。。与楼主共勉
赵4老师 2010-09-20
  • 打赏
  • 举报
回复
C++ Integer Constants
Integer constants are constant data elements that have no fractional parts or exponents. They always begin with a digit. You can specify integer constants in decimal, octal, or hexadecimal form. They can specify signed or unsigned types and long or short types.

Syntax

integer-constant :

decimal-constant integer-suffixopt
octal-constant integer-suffixopt
hexadecimal-constant integer-suffixopt
'c-char-sequence'

decimal-constant :

nonzero-digit
decimal-constant digit

octal-constant :

0
octal-constant octal-digit

hexadecimal-constant :

0x hexadecimal-digit
0X hexadecimal-digit
hexadecimal-constant hexadecimal-digit

nonzero-digit : one of

1 2 3 4 5 6 7 8 9

octal-digit : one of

0 1 2 3 4 5 6 7

hexadecimal-digit : one of

0 1 2 3 4 5 6 7 8 9
a b c d e f
A B C D E F

integer-suffix :

unsigned-suffix long-suffixopt
long-suffix unsigned-suffixopt

unsigned-suffix : one of

u U

long-suffix : one of

l L

64-bit integer-suffix :

i64

To specify integer constants using octal or hexadecimal notation, use a prefix that denotes the base. To specify an integer constant of a given integral type, use a suffix that denotes the type.

To specify a decimal constant, begin the specification with a nonzero digit. For example:

int i = 157; // Decimal constant
int j = 0198; // Not a decimal number; erroneous octal constant
int k = 0365; // Leading zero specifies octal constant, not decimal

To specify an octal constant, begin the specification with 0, followed by a sequence of digits in the range 0 through 7. The digits 8 and 9 are errors in specifying an octal constant. For example:

int i = 0377; // Octal constant
int j = 0397; // Error: 9 is not an octal digit

To specify a hexadecimal constant, begin the specification with 0x or 0X (the case of the “x” does not matter), followed by a sequence of digits in the range 0 through 9 and a (or A) through f (or F). Hexadecimal digits a (or A) through f (or F) represent values in the range 10 through 15. For example:

int i = 0x3fff; // Hexadecimal constant
int j = 0X3FFF; // Equal to i

To specify an unsigned type, use either the u or U suffix. To specify a long type, use either the l or L suffix. For example:

unsigned uVal = 328u; // Unsigned value
long lVal = 0x7FFFFFL; // Long value specified
// as hex constant
unsigned long ulVal = 0776745ul; // Unsigned long value

69,604

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧