易变量 [英] volatile variables

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

问题描述

HI,

许多流程都可以访问volatile变量..或者只有一个

流程可以访问它..


干杯..


Can volatile variables be accessed by many processess..or only one
process can access it..

Cheers..

推荐答案



" Radde" < MS ****** @ gmail.com>在消息中写道

news:11 ********************** @ o13g2000cwo.googlegr oups.com ...

"Radde" <ms******@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
HI,
许多流程都可以访问volatile变量..或者只有一个
进程可以访问它..

干杯..

Can volatile variables be accessed by many processess..or only one
process can access it..

Cheers..




很多,它只是一个不被优化的变量。


Ben



Many, it is just a variable not to be optimized away.

Ben


你可以更加精力充沛吗......

Can u be more eloborate on that..


挥发性和非易变性变量之间的唯一区别,目前为止
$ b据我所知,$ b是非优易编译器有机会完全被优化编译器消除。一些操作确实依赖于某些变量的存在,而编译器无法在编译时推断出

时间,这就是为什么你需要告诉它编译所以使用

" volatile"关键字。


这与从多个

处理器访问变量无直接关系。当然,变量需要存在才能被访问。


ben
The only difference between a volatile and a non-volatile variable, as far
as I know, is that the non-volatile one has a chance to be totally
eliminated by the optimizing compiler. A few operations does depend on the
existence of certain variables while the compiler can''t deduce at compile
time, and that''s why you need to tell the compiler so by using the
"volatile" keyword.

This has no direct connection with accessing the variable from multiple
processors. Of course, the variable needs to exists in order to be accessed.

ben


这篇关于易变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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