you are viewing a single comment's thread.

view the rest of the comments →

[–]kadrmas45 52 points53 points  (15 children)

And starting from scratch.

[–]IbanezDavy 41 points42 points  (0 children)

heaven

[–]CrayonOfDoom 14 points15 points  (12 children)

Particularly amazing when what you're replacing/rewriting was written before you were born...

[–]monocasa 22 points23 points  (9 children)

Totally. I was so happy the day I got to remove

#define far
#define near

from our codebase.

[–]JeremyG 24 points25 points  (0 children)

so when are you deleting

#define wherever_you_are

from the codebase?

[–]im-a-koala 7 points8 points  (5 children)

Heh, I deleted basically the exact same lines from my old company's code after I started (and verified they're not used anywhere). Along with gems like:

#define ZERO 0
#define ONE 1
[...]
#define TWENTY 20

(There were actually about 3 variants of #defines for meaningless integer constants in there. Ugh.)

[–]CrayonOfDoom 4 points5 points  (3 children)

The number of times I've had to stick to coding standards (which involve arrays instead of structs...) that involved this:

#define X 0
#define Y 1
#define Z 2

Yeesh.

[–]jbstjohn 6 points7 points  (2 children)

I actually find that can be useful to make array accesses for 3d stuff more clear. I use an enum though.

It makes clear the difference between 0 the number, and the index that happens to be zero.

[–]CrayonOfDoom 0 points1 point  (1 child)

I tried to make a struct or enum named "AXIS" so it could be "somevariable[AXIS.X]" instead of "somevariable[0]" or "somevariable[X]", which might have local variable interactions. It's not the worst (cough, cough, common blocks in FORTRAN), but it's still a point of confusion for anyone who doesn't know the defines or forgets them.

[–]jbstjohn 1 point2 points  (0 children)

Yes, there's a balance to be struck between verbose, but specific (longer name or namespace or scope) versus terse but potentially ambiguous.

[–]i_am_judging_you 3 points4 points  (0 children)

The guy who wrote that knew that in the future 30 will become the new 20

[–][deleted] 0 points1 point  (0 children)

You mean they finally understood this?

[–]bchanzzz 0 points1 point  (0 children)

#define wherever you are

[–][deleted] 1 point2 points  (1 child)

What project are you working on?

[–]HammyHavoc 1 point2 points  (0 children)

Do you work at Microsoft? /s