3 ms·
Yes, it's very old fashioned (K&R era). I think the reason for doing it this way rather than putting the type declaration alongside the parameter is then it wo
by petercooper 13y ago
Yes, it's very old fashioned (K&R era).
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:
main(BX,char**nE){
.. it would throw an expected identifier error on the char. So you'd be putting the original:
main(BX,nE)n**nE;{
Against this error-free alternative:
main(int BX,n**nE){
.. but that's one byte longer.
If I got any of this wrong, I hope someone will correct me though :)
- bunderbunder 13y agoSounds about right. The author mentions using K&R style function declarations as a way of shaving bytes in his writeup, too.
- mschuster91 13y agoAh, thanks for the explanation. Looks like the author did a deep, deep dive in the C language specs!
- hafflelog 13y agoK&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.