Re:Old C code – how to upgrade it?
by compressedgas on Friday April 08, 2022 @05:23PM
(#30962670)
I had actually got this to build and run. These are the changes I made to get it to compile under gcc 4.6.3 with -std=gnu89:
[ Parent
| on HN ]
Re:Old C code – how to upgrade it?
by zoomablemind on Saturday April 09, 2022 @04:04AM
(#30966093)
> ...
/* Place character represented by the value at TOS into
* the buffer. Decrement the pointer, and increment the count. */
- *(--(char*)hash_ptr.parm.v.p) = fpop(sst);
-
+ *((char*)hash_ptr.parm.v.p) = fpop(sst);
+ hash_ptr.parm.v.p = (char*)hash_ptr.parm.v.p - 1;
Are you sure that making assignment before the predecrement is how this fragment should be functioning?
Re:Old C code – how to upgrade it?
by compressedgas on Saturday April 09, 2022 @04:31AM
(#30966219)
The two lines should be swapped.
Re:Old C code – how to upgrade it?
by ketchupdog on Friday April 08, 2022 @07:09PM
(#30963603)
Did the examples work for you? I got the threads example to run on an M1 building with clang, but the dir example fails.
Re:Old C code – how to upgrade it?
by compressedgas on Friday April 08, 2022 @07:30PM
(#30963744)
I didn't test the examples. I sort of stopped once I got `1 2 +` to work.
Re:Old C code – how to upgrade it?
by compressedgas on Friday April 08, 2022 @06:42PM
(#30963392)
I think the third chunk should have its two new lines swapped.