免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: xyfree
打印 上一主题 下一主题

删帖吧 [复制链接]

论坛徽章:
0
31 [报告]
发表于 2011-10-11 17:45 |只看该作者
错了,不是翻译单元(这个时候这个概念还不必要)……
ISO C/C++在这里是一样的:
ISO C99 5.1.1.2/2 ...
幻の上帝 发表于 2011-10-11 17:33


谢谢科普~

论坛徽章:
2
青铜圣斗士
日期:2015-11-26 06:15:59数据库技术版块每日发帖之星
日期:2016-07-24 06:20:00
32 [报告]
发表于 2011-10-11 17:50 |只看该作者
回复 28# davelv

重庆还艳阳着呢,算是傍晚……
没找到合适的我妻由乃的头像…… 不然会考虑将神楽换掉……

再翻一页……

论坛徽章:
0
33 [报告]
发表于 2011-10-11 17:50 |只看该作者
回复  xxw19840406

隐藏在"Deep C"下的超链接:“我的存在感就这么低么” 。

翻了个页……
OwnWaterloo 发表于 2011-10-11 16:33



       高科技  没有发现!

论坛徽章:
0
34 [报告]
发表于 2011-10-11 17:52 |只看该作者
后面不太常用或者语言的阴暗处还是有的,虽然理解起来仍然没有超出基础知识的难度……
C99的printf增加的我刚好只记得%zu- -
p370 有些问题,据我所知一个_紧接小写字母没被保留;
p377 这里说operator new[] and delete[],不过如果总结之前的话,其实只是提到了new[] / delete[] operator/expression……

declartion vs definition 好像没怎么讲……是我网络渣摁翻页太快了吗?

struct A
{
void foo();
}

int main()
{
&(A::foo);
}
↑话说不来点这种玩意么……

论坛徽章:
2
青铜圣斗士
日期:2015-11-26 06:15:59数据库技术版块每日发帖之星
日期:2016-07-24 06:20:00
35 [报告]
发表于 2011-10-11 17:52 |只看该作者
回复 31# davelv
翻页失败……

回复 27# 幻の上帝
同感谢……  评分系统咋没了捏……

论坛徽章:
0
36 [报告]
发表于 2011-10-11 18:04 |只看该作者
回复  davelv

重庆还艳阳着呢,算是傍晚……
没找到合适的我妻由乃的头像…… 不然会考虑将神楽换掉… ...
OwnWaterloo 发表于 2011-10-11 17:50

杭州已经很黑了~
我妻由乃,各种联想。。。
抢了你的翻页,抱歉。
同问为什么不能评分。
话说我知道C99 新增了%ll   

论坛徽章:
2
青铜圣斗士
日期:2015-11-26 06:15:59数据库技术版块每日发帖之星
日期:2016-07-24 06:20:00
37 [报告]
发表于 2011-10-11 18:08 |只看该作者
回复 34# 幻の上帝

老师:
C++03
17.4.3.1.2 Global names
...
— Each name that begins with an underscore is reserved to the implementation for use as a name in the global namespace.165)
165) Such names are also reserved in namespace ::std (17.4.3.1).


GoF坑了一代人……  各种意义上……
msvc 8对 open 此类的函数的警告相当恶心…… 警告说 _open 才是符合 ISO C++ 的名字……

论坛徽章:
0
38 [报告]
发表于 2011-10-11 20:31 |只看该作者
本帖最后由 幻の上帝 于 2011-10-11 20:34 编辑
回复  幻の上帝

老师:


GoF坑了一代人……  各种意义上……
msvc 8对 open 此类的函数的警告相当 ...
OwnWaterloo 发表于 2011-10-11 18:08


老湿是啥……||= =
这里的name仅限于global namespace吧。。。那个例子里是class scope和block scope……一口咬定“不要用”是不是有点过头了。
好吧,稳妥起见不要用是最好……(不过我写C++程序除了入口函数、重写:: operator new([])/:: operator delete([])外都是在自定义的namespace里面搞的,所以这条几乎无视了……)

论坛徽章:
2
青铜圣斗士
日期:2015-11-26 06:15:59数据库技术版块每日发帖之星
日期:2016-07-24 06:20:00
39 [报告]
发表于 2011-10-11 22:45 |只看该作者
本帖最后由 OwnWaterloo 于 2011-10-11 22:48 编辑

回复 38# 幻の上帝

老师是尊称……

从实践上来说:
exceptional c++ Item 20. Class Mechanics 11. Avoid reserved names.

Yes, popular books like Design Patterns (Gamma95) do use leading underscores in variable names, but don't do it.
The standard reserves some leading-underscore identifiers for the implementation,
and the rules are hard enough to remember for you and for compiler writers
that you may as well avoid leading underscores entirely[1].
Instead, my own preference is to follow the convention of designating member variable names with a trailing underscore.

[1] For example, names with leading underscores are technically reserved only for nonmember names,
so some would argue that this isn't a problem and that class member names with leading underscores are fine.
That's not entirely true in practice,
because some implementations #define macros with leading-underscore names,
and macros don't respect scope.

They'll tromp on your member names as easily as they'll tromp on your nonmember names.
It's easier just to leave all leading underscores for implementers and avoid the possible hassles.


"some implementations #define macros with leading-underscore names"里的"leading-underscore"是指 _X, y__ 还是 _z ?
_X, y__ 应该是被保留作任意使用,不使用它们应该毫无异议。
所以我猜作者指的是 _z 。

也许作者是真的遇见过这样一种C++实现: 库的作者没能记住完整的规则, 所以使用 _z 作为宏名。

论坛徽章:
0
40 [报告]
发表于 2011-10-12 11:09 |只看该作者
为成为高手而努力,为成为高手中的高高手而奋斗
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP