Fix 2001/coupard for clang with linux
C99 does not support implicit int. There are three ways I can think of that would solve this problem but I chose to add the 'int' to the parameters to prevent any problems in the future.
This commit is contained in:
1 parent
f27438b248
commit
f2fe137618
2 files changed
+18
-1
No files matched your search
@@ -28,7 +28,7 @@ $",p[6789];
|
|||||||
|
|
||||||
int o[]={145,1145,1745,2545,3045,4045,4345,5145,5745,6369},i=0,j=0,l=0;
|
int o[]={145,1145,1745,2545,3045,4045,4345,5145,5745,6369},i=0,j=0,l=0;
|
||||||
|
|
||||||
void e(n,h){
|
void e(int n,int h){
|
||||||
for(j=0;n>0;n-=!(p[j++]^9));
|
for(j=0;n>0;n-=!(p[j++]^9));
|
||||||
for(;!n&&j[p]^9;j++)write(1,p+p[j][o],o[p[j]+1]-p[j][o]);
|
for(;!n&&j[p]^9;j++)write(1,p+p[j][o],o[p[j]+1]-p[j][o]);
|
||||||
for(i=0;i<h[o];i++)write(1,d+7,1);}
|
for(i=0;i<h[o];i++)write(1,d+7,1);}
|
||||||
|
|||||||
@@ -914,6 +914,23 @@ valid, btw.
|
|||||||
|
|
||||||
## [2001/coupard](2001/coupard/coupard.c) ([README.md](2001/coupard/README.md]))
|
## [2001/coupard](2001/coupard/coupard.c) ([README.md](2001/coupard/README.md]))
|
||||||
|
|
||||||
|
Cody fixed this to compile with clang in linux. The problem was C99 does not
|
||||||
|
support implicit int:
|
||||||
|
|
||||||
|
```c
|
||||||
|
coupard.c:31:10: error: parameter 'h' was not declared, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
|
||||||
|
void e(n,h){
|
||||||
|
^
|
||||||
|
coupard.c:31:8: error: parameter 'n' was not declared, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
|
||||||
|
void e(n,h){
|
||||||
|
^
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
One fix would be to disable that warning. Another one might be to change the C
|
||||||
|
standard. The one that was done, to make it more portable, was to just add 'int'
|
||||||
|
to the function parameters.
|
||||||
|
|
||||||
Thanks go to Yusuke for providing a proper command line for macOS (to do with
|
Thanks go to Yusuke for providing a proper command line for macOS (to do with
|
||||||
sound; see his [/2013/endoh3/README.md](2013/endoh3/README.md) entry where he
|
sound; see his [/2013/endoh3/README.md](2013/endoh3/README.md) entry where he
|
||||||
also refers to sound devices in macOS).
|
also refers to sound devices in macOS).
|
||||||
|
|||||||
Reference in new issue
Block a user