回答編集履歴

4

追記

2020/01/14 02:53

投稿

cateye
cateye

スコア6851

test CHANGED
@@ -150,6 +150,8 @@
150
150
 
151
151
  ^
152
152
 
153
+ ・・・Omit・・・
154
+
153
155
 
154
156
 
155
157
  fatal error: too many errors emitted, stopping now [-ferror-limit=]

3

誤記修正

2020/01/14 02:53

投稿

cateye
cateye

スコア6851

test CHANGED
@@ -1,3 +1,5 @@
1
+ ```text
2
+
1
3
  usr ~/Project/test % cc t1.c | grep error
2
4
 
3
5
  t1.c:15:5: warning: no previous extern declaration for non-static variable 'depth' [-Wmissing-variable-declarations]
@@ -154,6 +156,8 @@
154
156
 
155
157
  20 warnings and 20 errors generated.
156
158
 
159
+ ```
160
+
157
161
 
158
162
 
159
163
  ※Cを基礎から勉強し直して下さい。GCなんてまだ早いです。

2

追記

2020/01/14 02:40

投稿

cateye
cateye

スコア6851

test CHANGED
@@ -153,3 +153,7 @@
153
153
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
154
154
 
155
155
  20 warnings and 20 errors generated.
156
+
157
+
158
+
159
+ ※Cを基礎から勉強し直して下さい。GCなんてまだ早いです。

1

エラー追記

2020/01/14 02:11

投稿

cateye
cateye

スコア6851

test CHANGED
@@ -1,17 +1,155 @@
1
- 回答ではありません。
1
+ usr ~/Project/test % cc t1.c | grep error
2
2
 
3
- ・・・そもそもコンパイルできませんが?
3
+ t1.c:15:5: warning: no previous extern declaration for non-static variable 'depth' [-Wmissing-variable-declarations]
4
4
 
5
- ```text
5
+ int depth = -1;
6
6
 
7
- usr ~/Project/test % cc t1.c
7
+ ^
8
8
 
9
- t1.c:1:9: fatal error: 'studio.h' file not found
9
+ t1.c:15:1: note: declare 'static' if the variable is not intended to be used outside of this translation unit
10
10
 
11
- #include<studio.h>
11
+ int depth = -1;
12
12
 
13
- ^~~~~~~~~~
13
+ ^
14
14
 
15
- 1 error generated.
15
+ t1.c:16:5: warning: no previous extern declaration for non-static variable 'class_number' [-Wmissing-variable-declarations]
16
16
 
17
+ int class_number=0;
18
+
19
+ ^
20
+
21
+ t1.c:16:1: note: declare 'static' if the variable is not intended to be used outside of this translation unit
22
+
23
+ int class_number=0;
24
+
25
+ ^
26
+
27
+ t1.c:17:24: error: expected ';' after top level declarator
28
+
29
+ void *classes[512][512]{{0}};
30
+
31
+ ^
32
+
33
+ ;
34
+
35
+ t1.c:18:1: warning: empty struct has size 0 in C, size 1 in C++ [-Wc++-compat]
36
+
37
+ struct No_superclass{
38
+
39
+ ^
40
+
41
+ t1.c:18:1: warning: empty struct is a GNU extension [-Wgnu-empty-struct]
42
+
43
+ t1.c:19:2: error: expected ';' after struct
44
+
45
+ }
46
+
47
+ ^
48
+
49
+ ;
50
+
51
+ t1.c:24:13: warning: initializing 'void (*)(void *)' with an expression of type 'void *' converts between void pointer and function pointer [-Wpedantic]
52
+
53
+ void(*dlt)(void*)= classes[depth][i+1];
54
+
55
+ ^ ~~~~~~~~~~~~~~~~~~~
56
+
57
+ t1.c:26:7: warning: implicit declaration of function 'free' is invalid in C99 [-Wimplicit-function-declaration]
58
+
59
+ free(classes[depth][i]);
60
+
61
+ ^
62
+
63
+ t1.c:30:8: error: non-ASCII characters are not allowed outside of literals and identifiers
64
+
65
+ depth—;
66
+
67
+ ^
68
+
69
+ t1.c:30:3: warning: expression result unused [-Wunused-value]
70
+
71
+ depth—;
72
+
17
- ```
73
+ ^~~~~
74
+
75
+ t1.c:21:6: warning: no previous prototype for function 'delete_garbage' [-Wmissing-prototypes]
76
+
77
+ void delete_garbage(void){
78
+
79
+ ^
80
+
81
+ t1.c:21:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
82
+
83
+ void delete_garbage(void){
84
+
85
+ ^
86
+
87
+ static
88
+
89
+ t1.c:39:2: error: expected ';' after struct
90
+
91
+ } public Human {
92
+
93
+ ^
94
+
95
+ ;
96
+
97
+ t1.c:43:2: error: expected ';' after struct
98
+
99
+ }
100
+
101
+ ^
102
+
103
+ ;
104
+
105
+ t1.c:44:1: warning: declaration shadows a variable in the global scope [-Wshadow]
106
+
107
+ dtor(Human) {
108
+
109
+ ^
110
+
111
+ t1.c:9:60: note: expanded from macro 'dtor'
112
+
113
+ #define dtor(class_name) void class_name ## __delete(void *cslf)
114
+
115
+ ^
116
+
117
+ t1.c:3:7: note: previous declaration is here
118
+
119
+ void *cslf;
120
+
121
+ ^
122
+
123
+ t1.c:45:11: error: must use 'struct' tag to refer to type 'Human'
124
+
125
+ setThis(Human);
126
+
127
+ ^
128
+
129
+ struct
130
+
131
+ t1.c:11:32: note: expanded from macro 'setThis'
132
+
133
+ #define setThis(class_name) do{class_name this=(class_name)cslf;}while(0)
134
+
135
+ ^
136
+
137
+ t1.c:45:11: error: use of undeclared identifier 'Human'
138
+
139
+ t1.c:44:1: warning: unused parameter 'cslf' [-Wunused-parameter]
140
+
141
+ dtor(Human) {
142
+
143
+ ^
144
+
145
+ t1.c:9:60: note: expanded from macro 'dtor'
146
+
147
+ #define dtor(class_name) void class_name ## __delete(void *cslf)
148
+
149
+ ^
150
+
151
+
152
+
153
+ fatal error: too many errors emitted, stopping now [-ferror-limit=]
154
+
155
+ 20 warnings and 20 errors generated.