Re:An 8086 PC emulator in 4043 bytes
by bunderbunder on Saturday January 04, 2014 @03:32PM
(#7012777)
Sounds about right. The author mentions using K&R style function declarations as a way of shaving bytes in his writeup, too.
Re:An 8086 PC emulator in 4043 bytes
by mschuster91 on Saturday January 04, 2014 @03:35PM
(#7012797)
Ah, thanks for the explanation. Looks like the author did a deep, deep dive in the C language specs!
K&R predates the specs, actually. C89 codified the current C parameter convention. Compilers typically continue to support K&R style for very old C code and because it doesn't break modern C support.
I think the reason for doing it this way rather than putting the type declaration alongside the parameter is then it would also demand also adding an int declaration for the BX parameter which would then cause the code to be longer. That is to say with:
.. it would throw an expected identifier error on the char. So you'd be putting the original: Against this error-free alternative: .. but that's one byte longer.If I got any of this wrong, I hope someone will correct me though :)