<< |  >>
#7200 Dodano: 29-12-2013 12:28. Głosów: 302
From memory, the worst real-world macros/pre-processor abuse I've ever come across was:

#define RETURN(result) return (result);}

int myfunction1(args) {
int x = 0;
// do something
RETURN(x)

int myfunction2(args) {
int y = 0;
// do something
RETURN(y)

int myfunction3(args) {
int z = 0;
// do something
RETURN(z)

Yes that's right, no closing braces in any of the functions. Syntax highlighting was a mess, so he used vi to edit (not vim, it has syntax coloring!)

He was a Russian programmer who had mostly worked in assembly language. He was fanatical about saving as many bytes as possible because he had previously worked on systems with very limited memory. "It was for satellite. Only very few byte, so we use each byte over for many things." (bit fiddling, reusing machine instruction bytes for their numeric values) When I tried to find out what kinds of satellites, I was only able to get "Orbiting satellite. For making to orbit."

He had two other quirks: A convex mirror mounted above his monitor "For knowing who is watching", and an occasional sudden exit from his chair to do a quick ten pushups. He explained this last one as "Compiler found error in code. This is punishment".
<< |  >>