如何要求少量补充? (纯虚函数的语法)

发布于 2024-07-19 22:11:20 字数 1011 浏览 3 评论 0原文

当前的C++0x草案 我注意到他们引入了一些新的显式关键字来突出显示预期行为(伟大的举动!)。

示例:默认/删除函数 (< em>= 默认 和 = 删除),新的nullptr 常量,显式 关键字也可用于转换运算符,...

所以我希望看到纯虚函数的 = pure 语法。

相反,丑陋的(当然,恕我直言)= 0 的东西仍然存在。

好吧,我可以使用#define pure 0(有时我会这样做),但我认为连贯性/一致性绝对应该是标准的目标。 此外,我知道这只是一种极端迂腐的要求,但 = 0 确实是我最不喜欢的 C++ 部分之一(委婉说法)...

我的问题:

  • 我知道,新标准是功能-完整,但是仍然可以要求这个小的迂腐的补充,即使只是作为“必需的宏”的东西吗?
  • 如果答案是肯定的,怎么办? (周围有委员会成员吗?)
  • 我要求这个补充是不是有点太迂腐(或错误)? 您如何看待当前纯虚函数的语法?

In the current C++0x draft I've noticed they introduced some new explicit keywords to highlight expected behaviors (great move!).

Examples: defaulted/deleted functions (= default and = delete), the new nullptr constant, the explicit keyword usable also for conversion operators, ...

So I expected to see also a = pure syntax for pure virtual functions.

Instead the ugly (IMHO, of course) = 0 thing still exists.

Ok, I can use a #define pure 0 (and sometimes I do that), but I think coherency/consistency should be definitely a goal for a standard. Moreover I know it's just a sort of ultra-pedantic request, but = 0 was indeed one of my least favorite part of C++ (euphemism)...

My questions:

  • I know, the new standard is feature-complete, but is it still possible to ask for this small pedantic addition, even just as a "required macro" thing?
  • if the answer is positive, how? (any committee member around?)
  • am I just a bit too pedantic (or wrong) for asking this addition? what do you think about the current syntax of pure virtual functions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

各空 2024-07-26 22:11:20

这可不是一个小小的迂腐的改变。 引入新关键字是您可以要求的最大改变之一。 他们几乎不惜一切代价试图避免这种情况。 想想所有使用“纯粹”一词的代码,它们都会崩溃。

一般来说,他们的指导方针是只向语言中添加以前无法完成的内容。 pure 关键字不会启用任何新功能(例如,与 nullptr 关键字不同,它可以实现更好的类型检查),因此预计它的优先级非常低。 请记住,他们所做的任何事情基本上都是维护工作。 第一个目标是避免破坏语言(或使用它的现有代码)。 任何添加的功能只有在不破坏向后兼容性的情况下才能添加。

然而,该委员会或多或少是一个开放的论坛。 浏览他们的网站,您应该能够找到几个电子邮件地址。 或者使用 comp.std.c++ 新闻组。

我相信他们的会议也是开放的,所以你可以直接闯入下一场会议。 ;)

That's not a small pedantic change. Introducing a new keyword is one of the biggest changes you can ask for. It is something they try to avoid almost at any cost. Think of all the code that uses the word "pure", which would break.

In general, their guideline is to only add things to the language that could not be done before. A pure keyword wouldn't enable anything new (unlike the nullptr keyword, which enables better type checking, for example), so expect it to have a very low priority. Keep in mind that anything they do is basically maintenance work. The #1 goal is to avoid breaking the language (or existing code that uses it). Any features that are added on are only added if it can be done without breaking backward compatibility.

However, the committee is more or less an open forum. Browse around their website, and you should be able to find a few email addresses. OR use the comp.std.c++ newsgroup.

I believe their meetings are open as well, so you could just gatecrash the next one. ;)

空城旧梦 2024-07-26 22:11:20

关于 C++,你最讨厌的是“= 0;”???

使用过这种语言吗? 还有很多其他事情你可以更好地把你的仇恨花在上面。

<阻燃剂>我使用 C++ 已有 10 多年了。 对我来说,每当我需要进行一些繁重的计算工作时,它仍然是首选语言。

The thing you hate most about C++ is "= 0;"???

Have you ever used this language? There's plenty of other things you could be better spending your hate on.

<Flame retardant>I have used C++ for more than 10 years. For me it's still the language of choice whenever I need to do some computational heavy lifting.</Flame retardant>

稳稳的幸福 2024-07-26 22:11:20

首先,开始阅读 comp.std.c++ 新闻组。 这是公众讨论的地方。

其次,我想说,只有勘误表将应用于当前的 C++0x 草案,委员会确实处于最后阶段。

如果您非常热衷于这样做,请在新闻组中提出您的建议,并给出充分的理由。 并期望它被击落。 实质上更有用的提案(例如模块)尚未提出。

附录:如果您希望此类事情取得进展,您需要加入(ANSI 拥有的)委员会,或者在委员会中找到某人来推动您的提案。

First, start reading comp.std.c++ newsgroup. This is the place for public discussions.

Second, I would say that only errata will be applied to the current C++0x draft, the committee really is in the final stages.

If you are extremely keen, make your proposal in the newsgroup, with a really good justification. And expect it to be shot down. Substantially more useful proposals (e.g. modules) have not made it.

Addendum: If you want something like this to progress, you will need to either join (ANSI have of) the committee, or find someone on the committee to push your proposal.

懒的傷心 2024-07-26 22:11:20

为时已晚。 征集请求已于几年前结束。

(有一个页面保存了提交内容,但我再也找不到该列表了。)

Too late. The call for requests ended a couple of years ago.

(There was a page where the submissions were held but I can't find that list anymore.)

蘸点软妹酱 2024-07-26 22:11:20

除了 jalf 关于添加关键字的缺点的评论(我 100% 同意),您还应该注意计算机科学中的短语 纯函数已经有了意义。 这意味着给定相同的参数,函数总是返回相同的值并且没有副作用。 因此,选择 = pure 来指示必须重写的虚函数将是一个糟糕的语法选择。

In addition to jalf's comment about the drawbacks of adding a keyword (with which I agree 100%) you should also note than in computer science the phrase pure function already has a meaning. It means that given the same parameters a function always returns the same value and has no side effects. So choosing = pure to indicate a virtual function which must be overridden would be a bad syntax choice.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文