The Weird and The Wonderful
The Weird and The Wonderful forum is a place to post Coding Horrors,
Worst Practices, and the occasional flash of brilliance.
We all come across code that simply boggles the mind. Lazy kludges, embarrasing mistakes, horrid
workarounds and developers just not quite getting it. And then somedays we come across - or write -
the truly sublime.
Post your Best, your worst, and your most interesting. But please - no
programming questions . This forum is purely for amusement and discussions on code snippets. All
actual programming questions will be removed.
|
|
 |

|
Apparently, one of my co-workers found out that the GetTickCount function from the Windows API isn't reliable as it seemed in the first time he used it. The solution, obviously, was to refactor our code base to use a more reliable function, like timeGetTime.
I almost cried when I saw his commit changing a bunch of *.cpp files, with the following code in the beginning of every file:
#undef GetTickCount
#define GetTickCount timeGetTime
Sad thing is, he doesn't take criticism well.
|
|
|
|

|
Stop being such a bore! Don't criticize, teach! ^^
My programming get away... The Blog...
Taking over the world since 1371!
|
|
|
|

|
Even though it hurts my eyes a little, I must say that it does demonstrate some prettydamn good knowledge about how the C/++ compiler goes about things.
At least it didn't go into stdafx.h.
He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb]
Jonathan C Dickinson (C# Software Engineer)
|
|
|
|

|
Oh indeed, put it in a header file; not the code files. Code files should contain very few directives.
|
|
|
|

|
I think you'll find the technical term is refuctoring.
|
|
|
|
 |
|
|
General
News
Suggestion
Question
Bug
Answer
Joke
Rant
Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.