设计不一致? [英] Inconsistency by design?

查看:125
本文介绍了设计不一致?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我多年来一直在使用C ++,我认为我对它非常称职,但今天我只是注意到调用构造函数存在一些不一致的地方。如果你使用一个没有参数的构造函数,那么看来你必须在声明之后不要在括号之间加上任何东西。


示例:

I''ve been using C++ for years, and I thought that I was quite competent with it, but today I just noticed that there is something of an inconsistency with calling a constructor. If you use a constructor that has no parameters, then it appears that you must never put parentheses with nothing in between after the declaration.

Example:

展开 | 选择 | < span class =codeLinkonclick =WordWrap(this);> Wrap | 行号

推荐答案

  • 在g ++ 上我得到了一种''foo( )()'',甚至连编译器都不知道该怎么做的类型。
  • VC ++ 6.0给了我一个'致命错误C1001:内部编译器错误''。
  • On g++ I got a type of ''foo()()'', a type that not even the compiler knows quite what to do with.
  • VC++ 6.0 gave me a ''fatal error C1001: INTERNAL COMPILER ERROR''.



评论任何人?
Comments anyone?



我所知道的是,在使用默认参数初始化对象时,我读过永远不会使用一组空的括号 - 我从来没有费心去看过如果我没有会发生什么。

All I know is that I''ve read never to use an empty set of parentheses when initializing an object using the default parameter - I''ve never bothered seeing what would happen if I didn''t.

看来,如果你把++(两个连续性)加入并且它不在某些标签中斜体,当我提交或预览帖子时,它会将我发送到未找到页面页面...如果负责人可以解决这个问题,那么它会阻止人们在尝试发布时拔掉头发。 ;)



我遇到了同样的问题,所以还有其他几个用户。请放心,我们正努力尽力解决问题。

I''ve had the same problem, and so have a couple other users. Rest assured, we are working to try and fix the problem as best as we can.



我所知道的就是我在使用默认参数初始化对象时,永远不要使用一组空括号 - 我从来没有想过如果我不这样做会发生什么。
All I know is that I''ve read never to use an empty set of parentheses when initializing an object using the default parameter - I''ve never bothered seeing what would happen if I didn''t.



你在哪里读到的?我不确定自己为什么我没有把空括号除外,因为我发现它不能正常工作。我发现这很有意思。


Where did you read that? I''m not sure myself about why I don''t put the empty parentheses except that I probaby found it not to work properly. I just find that interesting.



我遇到了同样的问题,所以还有其他几个用户。请放心,我们正努力尽力解决问题。
I''ve had the same problem, and so have a couple other users. Rest assured, we are working to try and fix the problem as best as we can.



也许在论坛顶部放一个便利贴,或者如果你能修改消息输入页面,请在那里快速记下它?至少人们不会为此而烦恼并避免这个问题。


Adrian

Perhaps putting a sticky note at the top of the forum or if you are able to modify the message entry page, put a quick note about it there? At least people won''t be scratching their heads about it and avoid the problem.


Adrian


这篇关于设计不一致?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆