Simplify macOS fix to 1984/anonymous
It turns out I did not need to add a prototype to read() prior to main(); all that needed to be done is to specify the args (specifically the buffer, a void *, in the function (when defining it). Shortened it a bit by use of implicit ints where allowed.
This commit is contained in:
1 parent
d8906e0a4d
commit
55798ccbe6
2 files changed
+6
-7
No files matched your search
@@ -16,11 +16,10 @@ make all
|
|||||||
```
|
```
|
||||||
|
|
||||||
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this to work
|
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this to work
|
||||||
under macOS. The fix was to prototype `read()` prior to being defined and not
|
under macOS. The fix was to not use implicit `int`s in the `read()` function as
|
||||||
using `int, int, int` as the entry does. Instead the second arg is a `void *`.
|
it once did. Instead the second arg is a `void *`. In the `read()` function
|
||||||
In the `read()` function (which actually calls `write(2)`) the `i` (which is the
|
(which actually calls `write(2)`) the `i` (which is the `void *`) has to be cast
|
||||||
`void *`) has to be cast to an `int`. This solves the problem. Thank you Cody for
|
to an `int`. This solves the problem. Thank you Cody for your assistance!
|
||||||
your assistance!
|
|
||||||
|
|
||||||
|
|
||||||
## Judges' remarks:
|
## Judges' remarks:
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
int read(int,void*,int);i;main(){for(;i["]<i;++i){--i;}"];read('-'-'-',i+++"hell\
|
i;main(){for(;i["]<i;++i){--i;}"];read('-'-'-',i+++"hell\
|
||||||
o, world!\n",'/'/'/'));}read(int j,void *i,int p){write(j/p+p,i---j,(int)i/(int)i);}
|
o, world!\n",'/'/'/'));}read(j,i,p)void*i;{write(j/p+p,i---j,(int)i/(int)i);}
|
||||||
Reference in new issue
Block a user