define的奇怪用法

try325 2011-05-25 09:04:54
今天看程序,遇见这样一句,没看懂是什么意思
#define E (1&1t; &1t; 8)
...全文
274 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
AnYidan 2011-05-25
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 luciferisnotsatan 的回复:]
&1t; 这个是html的转义符,对应 <
[/Quote]

原来如此
赵4老师 2011-05-25
  • 打赏
  • 举报
回复
Certain characters have special meaning and are considered reserved in HTML documents. The following table lists each of the supported characters specified in the numeric and special graphic entity set, along with its name, syntax, and description.

This list is derived from ISO Standard 8879;1986/ENTITIES Numeric and Special Graphic//EN; however, HTML does not provide support for the entire entity set. Only the entities listed are supported.


Glyph Name Syntax Description
--------------------------------------

< lt < Less than sign
> gt > Greater than sign
& amp & Ampersand
" quot " Double quote sign


NOTE: The entity names are used in HTML, are always prefixed by ampersand (&), and are always followed by a semicolon (;). They represent particular graphic characters that have special meanings in places in the mark-up language, or may not be part of the character set available to you.


REFERENCES
"The HTML Reference Library for Windows 95," version 3.0, "Special Characters"

赵4老师 2011-05-25
  • 打赏
  • 举报
回复
CSpecialCharHashTable::CSpecialCharHashTable()
{
for (unsigned i=0; i<SPECIAL_CHAR_HASH_TABLE_SIZE; i++)
_aHashTable[i] = 0;

//
// Initialize the table with various Ascii string->Unicode mappings
//

//
// For lt and gt, use Unicode chars from private use area to avoid
// collision with '<' and '>' chars in Html tags. These will be
// mapped back to '<' and '>' by the scanner.
//
Add(L"lt", PRIVATE_USE_MAPPING_FOR_LT);
Add(L"gt", PRIVATE_USE_MAPPING_FOR_GT);

Add(L"amp", 0x26);
Add(L"quot", 0x22);
Add(L"nbsp", 0xa0);
Add(L"shy", 0xad);
Add(L"Agrave", 0xc0);
Add(L"agrave", 0xe0);
Add(L"Aacute", 0xc1);
Add(L"aacute", 0xe1);
Add(L"Acirc", 0xc2);
Add(L"acirc", 0xe2);
Add(L"Atilde", 0xc3);
Add(L"atilde", 0xe3);
Add(L"Auml", 0xc4);
Add(L"auml", 0xe4);
Add(L"Aring", 0xc5);
Add(L"aring", 0xe5);
Add(L"AElig", 0xc6);
Add(L"aelig", 0xe6);
Add(L"Ccedil", 0xc7);
Add(L"ccedil", 0xe7);
Add(L"Egrave", 0xc8);
Add(L"egrave", 0xe8);
Add(L"Eacute", 0xc9);
Add(L"eacute", 0xe9);
Add(L"Ecirc", 0xca);
Add(L"ecirc", 0xea);
Add(L"Euml", 0xcb);
Add(L"euml", 0xeb);
Add(L"Igrave", 0xcc);
Add(L"igrave", 0xec);
Add(L"Iacute", 0xcd);
Add(L"iacute", 0xed);
Add(L"Icirc", 0xce);
Add(L"icirc", 0xee);
Add(L"Iuml", 0xcf);
Add(L"iuml", 0xef);
Add(L"ETH", 0xd0);
Add(L"eth", 0xf0);
Add(L"Ntilde", 0xd1);
Add(L"ntilde", 0xf1);
Add(L"Ograve", 0xd2);
Add(L"ograve", 0xf2);
Add(L"Oacute", 0xd3);
Add(L"oacute", 0xf3);
Add(L"Ocirc", 0xd4);
Add(L"ocirc", 0xf4);
Add(L"Otilde", 0xd5);
Add(L"otilde", 0xf5);
Add(L"Ouml", 0xd6);
Add(L"ouml", 0xf6);
Add(L"Oslash", 0xd8);
Add(L"oslash", 0xf8);
Add(L"Ugrave", 0xd9);
Add(L"ugrave", 0xf9);
Add(L"Uacute", 0xda);
Add(L"uacute", 0xfa);
Add(L"Ucirc", 0xdb);
Add(L"ucirc", 0xfb);
Add(L"Uuml", 0xdc);
Add(L"uuml", 0xfc);
Add(L"Yacute", 0xdd);
Add(L"yacute", 0xfd);
Add(L"THORN", 0xde);
Add(L"thorn", 0xfe);
Add(L"szlig", 0xdf);
Add(L"yuml", 0xff);
Add(L"iexcl", 0xa1);
Add(L"cent", 0xa2);
Add(L"pound", 0xa3);
Add(L"curren", 0xa4);
Add(L"yen", 0xa5);
Add(L"brvbar", 0xa6);
Add(L"sect", 0xa7);
Add(L"die", 0xa8);
Add(L"copy", 0xa9);
Add(L"laquo", 0xab);
Add(L"reg", 0xae);
Add(L"macron", 0xaf);
Add(L"deg", 0xb0);
Add(L"plusmn", 0xb1);
Add(L"sup2", 0xb2);
Add(L"sup3", 0xb3);
Add(L"acute", 0xb4);
Add(L"micro", 0xb5);
Add(L"para", 0xb6);
Add(L"middot", 0xb7);
Add(L"cedil", 0xb8);
Add(L"supl", 0xb9);
Add(L"raquo", 0xbb);
Add(L"frac14", 0xbc);
Add(L"frac12", 0xbd);
Add(L"frac34", 0xbe);
Add(L"iquest", 0xbf);
Add(L"times", 0xd7);
Add(L"divide", 0xf7);
}
luciferisnotsatan 2011-05-25
  • 打赏
  • 举报
回复
&1t; 这个是html的转义符,对应 <
luciferisnotsatan 2011-05-25
  • 打赏
  • 举报
回复
就是把 E 替换成 (1&1t; &1t; 8)但这替换后的代码能不能跑呢???

看起来像是从网页上赋值时,把转义符本身给考过来了。
估计是
#define E (1<<8)
ljt3969636 2011-05-25
  • 打赏
  • 举报
回复
某人名言“编译选项加/EP /P,重新编译,查看宏展开后对应的.i文件。”
無_1024 2011-05-25
  • 打赏
  • 举报
回复
宏定义一段执行代码 然后调用E就顺序执行那段代码
lt114896 2011-05-25
  • 打赏
  • 举报
回复
确实很奇怪,编译都通不过!
就想叫yoko 2011-05-25
  • 打赏
  • 举报
回复
学习一下
产生预处理文件[Quote=引用 3 楼 ljt3969636 的回复:]

某人名言“编译选项加/EP /P,重新编译,查看宏展开后对应的.i文件。”
[/Quote]
LucEaspe 2011-05-25
  • 打赏
  • 举报
回复
宏 #define 不会被编译器编译
pathuang68 2011-05-25
  • 打赏
  • 举报
回复
如果你写过cgi程序,你就很清楚了...不过,现在很少人写cgi了...
pathuang68 2011-05-25
  • 打赏
  • 举报
回复
[Quote=引用楼主 try325 的回复:]
今天看程序,遇见这样一句,没看懂是什么意思
#define E (1&1t; &1t; 8)
[/Quote]

你在网页中看到的内容,实际内容不是那样的。实际的代码应该是:

#define E (1 << 8)


这说明那个网页写得不好。
生生 2011-05-25
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 luciferisnotsatan 的回复:]
&1t; 这个是html的转义符,对应 <
[/Quote]

同意5楼的解释

经常会在网页中遇到  这个也是html的转义符,是空格。
  • 打赏
  • 举报
回复
不要想得太难
hzc543806053 2011-05-25
  • 打赏
  • 举报
回复

&amp;1t; 这个是html的转义符,对应 <

lucif0908 2011-05-25
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 luciferisnotsatan 的回复:]

&1t; 这个是html的转义符,对应 <
[/Quote]
++
guyu2011 2011-05-25
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 luciferisnotsatan 的回复:]

&1t; 这个是html的转义符,对应 <
[/Quote]
我说<怎么这么熟悉呢,原来在看html的时候碰到过

70,035

社区成员

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

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