我想在C ++ 2009中看到两件事 [英] Two things I'd like to see in C++ 2009

查看:76
本文介绍了我想在C ++ 2009中看到两件事的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道RAII和BS对先前请求的回应,但我真的很想看到'b $ b'喜欢在C ++异常处理中看到''finally''。是的,我们可以在没有''终于'的情况下生活
但是这意味着更多的打字(更多课程)

简单的场景(比如在函数前调用LeaveCriticalSection())

返回)。它还可以将其他语言移植到C ++中更简单。


我想看到的另一件事是''可重入''关键字可以是

应用于函数和方法。当非重入函数被标记为可重入时,编译器应该具有投诉所需的所有信息


I know about RAII and BS''s response to previous requests, but I''d really
love to see ''finally'' available in C++ exception handling. Yes, we can
live without ''finally'' but it means a bit more typing (more classes) for
simple scenarios (like calling LeaveCriticalSection() before a function
returns). It would also make porting other languages to C++ a bit more
simple.

Another thing I''d like to see is a ''reentrant'' keyword that can be
applied to functions and methods. The compiler should have all the info
necessary to complain when a non-reentrant function is labeled as reentrant.

推荐答案

J.史密斯写道:

另一件我想看到的是一个''reentrant''关键字,可以应用于函数和方法。当非重入函数被标记为
可重入时,编译器应该具有所需的所有信息。

Another thing I''d like to see is a ''reentrant'' keyword that can be
applied to functions and methods. The compiler should have all the info
necessary to complain when a non-reentrant function is labeled as
reentrant.




那么编译器将如何识别不可重入的功能?


-

Joe Seigh


当你拿柠檬时,你做柠檬水。

当你拿到硬件时,就会制作软件。



So how would the compiler identify a non-reentrant function?

--
Joe Seigh

When you get lemons, you make lemonade.
When you get hardware, you make software.


Joe Seigh写道:
Joe Seigh wrote:
J. Smith写道:
J. Smith wrote:
我想看到的另一件事是一个''reentrant''关键字,可以应用于函数和方法。当非重入函数被标记为
可重入时,编译器应该具有必要的所有信息。
Another thing I''d like to see is a ''reentrant'' keyword that can be
applied to functions and methods. The compiler should have all the info
necessary to complain when a non-reentrant function is labeled as
reentrant.



那么编译器如何识别非可重入函数?



So how would the compiler identify a non-reentrant function?




它不使用静态或全局变量。但是一个新关键字是

''不成比例''。



It uses no static or global variables. But a new keyword is
''disproportionate''.


J.史密斯写道:
我知道RAII和BS对先前请求的回应,但我真的很想看到终于在C ++异常处理中可用。
I know about RAII and BS''s response to previous requests, but I''d really
love to see ''finally'' available in C++ exception handling.




您可能对RAII不太了解(足够)。否则你不会想要一个''终于''。



You probably don''t know (enough) about RAII. Otherwise you wouldn''t
want a ''finally''.


这篇关于我想在C ++ 2009中看到两件事的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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