teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

ソース追記

2019/04/26 10:35

投稿

cateye
cateye

スコア6851

answer CHANGED
@@ -1,3 +1,33 @@
1
1
  参考:
2
2
  [構造体パッキング](http://tool-support.renesas.com/autoupdate/support/onlinehelp/ja-JP/csp/V4.01.00/CS+.chm/Compiler-CCRH.chm/Output/ccrh04c0204y0800.html)
3
- [前へならえ](http://www7b.biglobe.ne.jp/~robe/cpphtml/html03/cpp03014.html)
3
+ [前へならえ](http://www7b.biglobe.ne.jp/~robe/cpphtml/html03/cpp03014.html)
4
+ //
5
+ ```c
6
+ struct abc {
7
+ int A;
8
+ int B;
9
+ int C;
10
+ char D;
11
+ };
12
+ //
13
+ int main(void)
14
+ {
15
+ struct abc val;
16
+
17
+ return 0;
18
+ }
19
+
20
+ ```
21
+ 上記コードで、以下のワーニングがでます。VCはわからないのですがエラーの設定で最強のエラーチェックにすれば出るのではないかと?
22
+ ```text
23
+ usr ~/Project/test % clang -Weverything st.c
24
+ st.c:10:16: warning: unused variable 'val' [-Wunused-variable]
25
+ struct abc val;
26
+ ^
27
+ st.c:1:8: warning: padding size of 'struct abc' with 3 bytes to alignment boundary [-Wpadded]
28
+ struct abc {
29
+ ^
30
+ 2 warnings generated.
31
+ usr ~/Project/test %
32
+
33
+ ```