LoginSignup
0
0

More than 5 years have passed since last update.

secure coding > size = sizeof(x++); > sizeof演算の()の中の式は実行されない

Last updated at Posted at 2015-03-26

組込みソフトウェア開発向けコーディング作法ガイド [C言語版] 初版第1刷

この本のp129に「例2. 実行されない式を記述」の例として以下のものがある。

cのコード
size = sizeof(x++);

説明では「sizeof演算の()の中の式は、式の型のサイズが求められるだけで、式の実行は行われません。」とある。

ideoneでコードを書いてみると (link)、確かにx++は実行されていなかった。

ただ、sizeof(x++)というxを加算しながらsizeofを取る必要性が自分の関連するものとしては思いつかない。

0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0