再次尝试使用sizeof [解释通缉] [英] tryick use of sizeof again[Explaination Wanted]

查看:85
本文介绍了再次尝试使用sizeof [解释通缉]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

char ch =''a'';


int v = sizeof ++ ch;


cout<< ch< < endl; //输出:''a''


为什么不''b''?

谢谢

char ch=''a'';

int v=sizeof ++ch;

cout<<ch<<endl;// output: ''a''

why not ''b''?
thanks

推荐答案

9月14日上午11点16分,goacr ... @ gmail.com写道:
On Sep 14, 11:16 am, goacr...@gmail.com wrote:

char ch =''a'';


int v = sizeof ++ ch;


cout<< ch<< ; endl; //输出:''a''


为什么不''b''
char ch=''a'';

int v=sizeof ++ch;

cout<<ch<<endl;// output: ''a''

why not ''b''



谁知道C ++的流行?为什么不在comp.lang.c ++中询问

?我们在这里不处理C ++,只有C

Who knows the vagarities of C++? Why not ask in comp.lang.c++ instead
of here? We don''t deal with C++ here, only C


go ** **** @gmail.com 写道:

char ch =''a'';


int v = sizeof ++ ch;


cout<< ch<< endl; //输出:''a''


为什么不''b''?


谢谢
char ch=''a'';

int v=sizeof ++ch;

cout<<ch<<endl;// output: ''a''

why not ''b''?
thanks



不评估sizeof表达式。只有类型很重要

来获得它的大小。

sizeof expressions are NOT evaluated. Only the type is important
to get the size of it.


" Lew Pitcher" < lp ****** @teksavvy.comaécritdansle message de news:
11 ********************** @ w3g2000hsg.googlegroups.c om ...
"Lew Pitcher" <lp******@teksavvy.coma écrit dans le message de news:
11**********************@w3g2000hsg.googlegroups.c om...

9月14日上午11点16分,goacr ... @ gmail.com写道:
On Sep 14, 11:16 am, goacr...@gmail.com wrote:

> char ch =''a'';

int v = sizeof ++ ch;

cout<< ch<< endl; // output:' 'a''

为什么不''b''
>char ch=''a'';

int v=sizeof ++ch;

cout<<ch<<endl;// output: ''a''

why not ''b''



谁知道C ++的怪癖?为什么不在comp.lang.c ++中询问

?我们在这里不处理C ++,只有C


Who knows the vagarities of C++? Why not ask in comp.lang.c++ instead
of here? We don''t deal with C++ here, only C



当问题不是特定于C ++时,为什么会有不必要的麻烦。


sizeof expr计算由expr表示的对象的大小(以字节为单位),而不是生成用于评估该表达式的代码。因此ch不会增加



-

Chqrlie。

Why be unnecessarily obtuse when the issue is not C++ specific.

sizeof expr computes the size in bytes of the object denoted by expr without
producing code for evaluating that expression. Therefore ch is not
incremented.

--
Chqrlie.


这篇关于再次尝试使用sizeof [解释通缉]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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