字面量存储在语句中像这样if(var =='x')? [英] Where are literals stored in statement like this if( var == 'x')?

查看:165
本文介绍了字面量存储在语句中像这样if(var =='x')?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在此类语句中说

char var;

if( var == 'x');

我们首先为x分配任何内存吗?

Do we allocate any memory for 'x' at first place?

如果是,它是(堆栈/数据)?

If yes, which is it (stack/data)?

谢谢!

推荐答案

值'x'直接在代码段中作为比较指令的一部分,或者可以将其存储在代码段中以立即加载到寄存器中,或者在用于间接加载或比较的数据段中。这取决于编译器。

The value 'x' may be stored directly in the code segment as part of the comparison instruction, or it may be stored in the code segment for an immediate load into a register, or in the data segment for an indirect load or compare. It is up to the compiler.

这篇关于字面量存储在语句中像这样if(var =='x')?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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