c/c++
構造体は境界調整される(パディング=詰め物、アライメント=調整) コンパイラがデータをメモリに効率良い様に配置する。 奇数アドレスを避け、偶数アドレスにする。 処理系によっては2byte単位ではなく4byte単位になったりする。 typedef struct { char a;…
$ gcc -dM -E - < /dev/null g++でも同じ。 [GCC][C/C++][Linux] GCCの定義済みマクロ(predefined macros)のダンプ - Qiita
とあるi2cを使うcコードでコンパイル警告とリンクエラーが出た。 コンパイル警告 warning: implicit declaration of function ‘i2c_smbus_write_byte_data’ warning: implicit declaration of function ‘i2c_smbus_read_byte’ リンクエラー undefined refere…
何エラーか良くわからんかったが、どうやら std::istringstreamを使うには<sstream>が必要、ということだった。 ヘッダをインクルードしたら解決した。 error: variable ‘std::istringstream in’ has initializer but incomplete type std::istringstream hoge(fuga);</sstream>…