Click here to Skip to main content
11,707,470 members (73,231 online)

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.

 
GeneralRe: Bug of the day Pin
BobJanova13-Jun-13 0:54
memberBobJanova13-Jun-13 0:54 
GeneralRe: Bug of the day Pin
Gary Wheeler13-Jun-13 1:08
memberGary Wheeler13-Jun-13 1:08 
GeneralRe: Bug of the day Pin
BobJanova13-Jun-13 2:12
memberBobJanova13-Jun-13 2:12 
GeneralRe: Bug of the day Pin
Cornelius Henning13-Jun-13 4:13
memberCornelius Henning13-Jun-13 4:13 
GeneralRe: Bug of the day Pin
Gary Wheeler13-Jun-13 4:21
memberGary Wheeler13-Jun-13 4:21 
GeneralRe: Bug of the day Pin
cjb11020-Jun-13 2:37
membercjb11020-Jun-13 2:37 
GeneralRe: Bug of the day Pin
Gary Wheeler24-Jun-13 0:21
memberGary Wheeler24-Jun-13 0:21 
GeneralRe: Bug of the day Pin
StatementTerminator13-Jun-13 5:21
memberStatementTerminator13-Jun-13 5:21 
JokeRe: Bug of the day Pin
Bernhard Hiller12-Jun-13 21:27
professionalBernhard Hiller12-Jun-13 21:27 
GeneralRe: Bug of the day Pin
R. Erasmus12-Jun-13 21:38
memberR. Erasmus12-Jun-13 21:38 
GeneralRe: Bug of the day Pin
Fabio Franco13-Jun-13 1:21
memberFabio Franco13-Jun-13 1:21 
GeneralRe: Bug of the day Pin
gervacleto13-Jun-13 2:24
membergervacleto13-Jun-13 2:24 
GeneralRe: Bug of the day Pin
Fabio Franco13-Jun-13 2:54
memberFabio Franco13-Jun-13 2:54 
GeneralRe: Bug of the day Pin
gervacleto13-Jun-13 3:45
membergervacleto13-Jun-13 3:45 
This errors can be present in C like language. The last only in C#

This one is usual (very)
if(Something)
    One();
    two();
    ...
Of course only One() is inside the if(), but it seems that the other two instructions are inside also. I did fall in this bug many times until I decided to enclose into curly braces any if() or loop with one or more instructions. It could increase the number of lines, but, for sure, decrease the bugs.
Other one:
bool MyBoolValue = true;
 
if(MyBoolValue = false){
... SomeStuff ...
}
Maybe the compiler throws a warning, but this statement is valid. Surely is not what you want to do because you have omitted one equal sign:
if(MyBoolValue == false)...
I have no solution to this one, but to check again Sigh | :sigh:
Of course the comparison is not necessary, because MyBoolValue is true or false per se. Wink | ;)
if(MyBoolValue)...

for(int i = 0; i < MyArray.GetUpperBound(0); i++){
SomeStuff....
}
You must remember that GetUpperBound(0) does not start in '0' but in '1', because is the number of elements not the dimensions of the array so it must be:
for(int i = 0; i <= MyArray.GetUpperBound(0); i++)
I will try to remember more "Mistakes" that are common for me, but for sure here are more qualified people to show you many more.
You may forget having good days, just because you are remembering the past or thinking too much about the future. Live now and enjoy the moment!!

GeneralRe: Bug of the day Pin
Pablo Aliskevicius13-Jun-13 3:53
memberPablo Aliskevicius13-Jun-13 3:53 
GeneralRe: Bug of the day Pin
StatementTerminator13-Jun-13 5:40
memberStatementTerminator13-Jun-13 5:40 
GeneralRe: Bug of the day Pin
Fabio Franco13-Jun-13 3:54
memberFabio Franco13-Jun-13 3:54 
GeneralRe: Bug of the day Pin
MainFrameMan_ALIVE_AND_WELL$$13-Jun-13 4:32
memberMainFrameMan_ALIVE_AND_WELL$$13-Jun-13 4:32 
GeneralRe: Bug of the day Pin
RafagaX13-Jun-13 5:31
memberRafagaX13-Jun-13 5:31 
GeneralRe: Bug of the day Pin
Adam David Hill14-Jun-13 5:26
memberAdam David Hill14-Jun-13 5:26 
GeneralRe: Bug of the day Pin
Marc Clifton18-Jun-13 5:32
protectorMarc Clifton18-Jun-13 5:32 
GeneralProductivity Wars Pin
jim lahey7-Jun-13 4:42
memberjim lahey7-Jun-13 4:42 
GeneralRe: Productivity Wars Pin
BobJanova7-Jun-13 4:57
memberBobJanova7-Jun-13 4:57 
GeneralRe: Productivity Wars Pin
jim lahey7-Jun-13 5:04
memberjim lahey7-Jun-13 5:04 
GeneralRe: Productivity Wars Pin
R. Erasmus11-Jun-13 3:28
memberR. Erasmus11-Jun-13 3:28 
GeneralRe: Productivity Wars Pin
jesarg7-Jun-13 6:14
memberjesarg7-Jun-13 6:14 
GeneralRe: Productivity Wars Pin
Chris Maunder7-Jun-13 14:57
adminChris Maunder7-Jun-13 14:57 
GeneralRe: Productivity Wars Pin
AspDotNetDev7-Jun-13 15:18
protectorAspDotNetDev7-Jun-13 15:18 
GeneralRe: Productivity Wars Pin
V.9-Jun-13 22:22
professionalV.9-Jun-13 22:22 
GeneralRe: Productivity Wars Pin
harold aptroot10-Jun-13 3:19
memberharold aptroot10-Jun-13 3:19 
GeneralRe: Productivity Wars Pin
YvesDaoust10-Jun-13 20:47
memberYvesDaoust10-Jun-13 20:47 
GeneralRe: Productivity Wars Pin
Fran Porretto11-Jun-13 1:00
memberFran Porretto11-Jun-13 1:00 
GeneralRe: Productivity Wars Pin
vonb11-Jun-13 1:40
membervonb11-Jun-13 1:40 
GeneralRe: Productivity Wars Pin
Dominic Amann11-Jun-13 2:52
memberDominic Amann11-Jun-13 2:52 
GeneralRe: Productivity Wars Pin
jim lahey11-Jun-13 6:00
memberjim lahey11-Jun-13 6:00 
GeneralRe: Productivity Wars Pin
StatementTerminator11-Jun-13 4:08
memberStatementTerminator11-Jun-13 4:08 
GeneralRe: Productivity Wars Pin
BrainiacV11-Jun-13 4:40
memberBrainiacV11-Jun-13 4:40 
GeneralRe: Productivity Wars Pin
StatementTerminator11-Jun-13 5:00
memberStatementTerminator11-Jun-13 5:00 
GeneralRe: Productivity Wars Pin
jnlt11-Jun-13 6:10
memberjnlt11-Jun-13 6:10 
GeneralRe: Productivity Wars Pin
CarlosAlbertoEstrada11-Jun-13 6:11
memberCarlosAlbertoEstrada11-Jun-13 6:11 
GeneralRe: Productivity Wars Pin
StatementTerminator11-Jun-13 6:43
memberStatementTerminator11-Jun-13 6:43 
GeneralRe: Productivity Wars Pin
RafagaX11-Jun-13 7:31
memberRafagaX11-Jun-13 7:31 
GeneralRe: Productivity Wars Pin
jschell11-Jun-13 8:19
memberjschell11-Jun-13 8:19 
GeneralDeveloper whose first language is not English Pin
Chris Quinn7-Jun-13 3:17
memberChris Quinn7-Jun-13 3:17 
GeneralRe: Developer whose first language is not English Pin
jim lahey7-Jun-13 4:57
memberjim lahey7-Jun-13 4:57 
GeneralRe: Developer whose first language is not English Pin
OriginalGriff7-Jun-13 5:02
protectorOriginalGriff7-Jun-13 5:02 
GeneralRe: Developer whose first language is not English Pin
ENOTTY7-Jun-13 5:08
memberENOTTY7-Jun-13 5:08 
GeneralRe: Developer whose first language is not English Pin
Amitosh Swain11-Jun-13 16:34
memberAmitosh Swain11-Jun-13 16:34 
JokeRe: Developer whose first language is not English Pin
VUnreal2-Jul-13 9:39
memberVUnreal2-Jul-13 9:39 
GeneralERROR_SUCCESS => the successful error Pin
damn.tiby6-Jun-13 21:26
memberdamn.tiby6-Jun-13 21:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web04 | 2.8.150819.1 | Last Updated 31 Aug 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid