News for hackers. Stuff that matters.
Re:An 8086 PC emulator in 4043 bytes by mschuster91 on Saturday January 04, 2014 @02:59PM (#7012622)
But the char is outside of the declaration and before the opening brace - is this legal? And especially, why isn't it written like main(BX,charnE)? Doesn't save any bytes,it rather adds one semicolon...
Re:An 8086 PC emulator in 4043 bytes by petercooper on Saturday January 04, 2014 @03:16PM (#7012699)
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 :)

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!
Re:An 8086 PC emulator in 4043 bytes by hafflelog on Saturday January 04, 2014 @08:06PM (#7013886)
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.
Re:An 8086 PC emulator in 4043 bytes by someaccount on Saturday January 04, 2014 @03:08PM (#7012660)
Because it's not entirely about size, it's an obfuscation contest. Anything strange or unusual, especially something most people haven't seen used, will help obfuscate the code.