Click here to Skip to main content
13,260,108 members (46,180 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, embarrassing 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.

 
GeneralVal Grind (the wrong kind) Pin
Rob Grainger20-Dec-12 6:12
memberRob Grainger20-Dec-12 6:12 
GeneralRe: Val Grind (the wrong kind) Pin
Naerling20-Dec-12 11:40
memberNaerling20-Dec-12 11:40 
GeneralRe: Val Grind (the wrong kind) Pin
Nagy Vilmos20-Dec-12 23:55
memberNagy Vilmos20-Dec-12 23:55 
GeneralRe: Val Grind (the wrong kind) Pin
Brady Kelly2-Jan-13 22:46
memberBrady Kelly2-Jan-13 22:46 
GeneralRe: Val Grind (the wrong kind) Pin
Nagy Vilmos2-Jan-13 23:52
memberNagy Vilmos2-Jan-13 23:52 
GeneralRe: Val Grind (the wrong kind) Pin
LesF4-Jan-13 10:51
memberLesF4-Jan-13 10:51 
GeneralRe: Val Grind (the wrong kind) Pin
Rob Grainger4-Jan-13 11:09
memberRob Grainger4-Jan-13 11:09 
GeneralRe: Val Grind (the wrong kind) Pin
Naerling4-Jan-13 12:56
memberNaerling4-Jan-13 12:56 
GeneralRe: Val Grind (the wrong kind) Pin
Member 46088986-Jan-13 12:45
memberMember 46088986-Jan-13 12:45 
GeneralRe: Val Grind (the wrong kind) Pin
Naerling6-Jan-13 13:26
memberNaerling6-Jan-13 13:26 
GeneralRe: Val Grind (the wrong kind) Pin
Chris Quinn24-Dec-12 1:19
memberChris Quinn24-Dec-12 1:19 
GeneralRe: Val Grind (the wrong kind) Pin
Rob Grainger29-Dec-12 4:19
memberRob Grainger29-Dec-12 4:19 
GeneralRe: Val Grind (the wrong kind) Pin
Chris Quinn31-Dec-12 1:17
memberChris Quinn31-Dec-12 1:17 
GeneralRe: Val Grind (the wrong kind) Pin
Rob Grainger31-Dec-12 3:57
memberRob Grainger31-Dec-12 3:57 
You've missed the point again. I know exactly what the trick is doing. I'll spell it out slowly...

1. The first line declares PolNumb As Long.
2. Consequently, we know PolNumb is always a number.
3. The line If Val("" & PolNumb) > 0 Then effectively converts PolNumb to a string and appends it to an empty string, simply to convert it back to a number using Val, and finally checks if the result is greater than 0.

That line could be replaced with If PolNumb > 0 Then and be more efficient and more correct (as conceivably PolNumbcould be zero).

The issue is not the use of the Val("" & variant) trick, but the misuse of it applied to something we already know to be a number.
AnswerRe: Val Grind (the wrong kind) Pin
Mark Hurd3-Jan-13 15:32
memberMark Hurd3-Jan-13 15:32 
GeneralRe: Val Grind (the wrong kind) Pin
Rob Grainger4-Jan-13 10:55
memberRob Grainger4-Jan-13 10:55 
GeneralRe: Val Grind (the wrong kind) Pin
Mark Hurd4-Jan-13 15:56
memberMark Hurd4-Jan-13 15:56 
GeneralRe: Val Grind (the wrong kind) Pin
playstation328-Dec-12 22:22
memberplaystation328-Dec-12 22:22 
JokeRe: Val Grind (the wrong kind) Pin
RafagaX3-Jan-13 5:57
memberRafagaX3-Jan-13 5:57 
GeneralRe: Val Grind (the wrong kind) Pin
dshillito3-Jan-13 11:58
memberdshillito3-Jan-13 11:58 
GeneralRe: Val Grind (the wrong kind) Pin
Rob Grainger4-Jan-13 10:56
memberRob Grainger4-Jan-13 10:56 
GeneralRe: Val Grind (the wrong kind) Pin
cpkilekofp11-Jan-13 8:02
membercpkilekofp11-Jan-13 8:02 
GeneralRe: Val Grind (the wrong kind) Pin
Rob Grainger11-Jan-13 8:42
memberRob Grainger11-Jan-13 8:42 
GeneralI am the Legend of Grimrock Poster Pin
Rob Grainger17-Dec-12 12:35
memberRob Grainger17-Dec-12 12:35 
GeneralRe: I am the Legend of Grimrock Poster Pin
Zac Greve17-Dec-12 18:25
memberZac Greve17-Dec-12 18:25 
JokeRe: I am the Legend of Grimrock Poster Pin
Member 829282421-Jan-13 4:01
memberMember 829282421-Jan-13 4:01 
GeneralIt does what now? Pin
Member 869907216-Dec-12 9:23
memberMember 869907216-Dec-12 9:23 
GeneralRe: It does what now? Pin
Zac Greve16-Dec-12 10:47
memberZac Greve16-Dec-12 10:47 
GeneralRe: It does what now? Pin
Brady Kelly16-Dec-12 21:40
memberBrady Kelly16-Dec-12 21:40 
GeneralRe: It does what now? Pin
Pete O'Hanlon17-Dec-12 4:59
protectorPete O'Hanlon17-Dec-12 4:59 
GeneralRe: It does what now? Pin
kdmote17-Dec-12 6:51
memberkdmote17-Dec-12 6:51 
GeneralRe: It does what now? Pin
Marius Bancila21-Dec-12 2:08
memberMarius Bancila21-Dec-12 2:08 
GeneralRe: It does what now? Pin
jlopez78826-Dec-12 19:26
memberjlopez78826-Dec-12 19:26 
AnswerRe: It does what now? Pin
VUnreal8-Feb-13 11:32
memberVUnreal8-Feb-13 11:32 
GeneralWho needs a UL? Pin
AnalogNerd14-Dec-12 11:50
memberAnalogNerd14-Dec-12 11:50 
GeneralRe: Who needs a UL? Pin
Brady Kelly16-Dec-12 21:39
memberBrady Kelly16-Dec-12 21:39 
GeneralRe: Who needs a UL? Pin
englebart17-Dec-12 3:35
memberenglebart17-Dec-12 3:35 
GeneralRe: Who needs a UL? Pin
AnalogNerd17-Dec-12 3:54
memberAnalogNerd17-Dec-12 3:54 
GeneralRe: Who needs a UL? Pin
Kasmarch17-Dec-12 4:08
memberKasmarch17-Dec-12 4:08 
GeneralRe: Who needs a UL? Pin
Zac Greve17-Dec-12 5:46
memberZac Greve17-Dec-12 5:46 
GeneralRe: Who needs a UL? Pin
AnalogNerd17-Dec-12 5:52
memberAnalogNerd17-Dec-12 5:52 
GeneralRe: Who needs a UL? Pin
Zac Greve17-Dec-12 9:13
memberZac Greve17-Dec-12 9:13 
GeneralRe: Who needs a UL? Pin
Climate Turnip17-Dec-12 9:57
memberClimate Turnip17-Dec-12 9:57 
GeneralRe: Who needs a UL? Pin
Josh_T17-Dec-12 19:31
memberJosh_T17-Dec-12 19:31 
GeneralRe: Who needs a UL? Pin
AnalogNerd20-Dec-12 9:44
memberAnalogNerd20-Dec-12 9:44 
GeneralRe: Who needs a UL? Pin
Zac Greve20-Dec-12 10:53
memberZac Greve20-Dec-12 10:53 
GeneralFound this little gem in one of the applications Pin
d@nish 13-Dec-12 7:01
member d@nish 13-Dec-12 7:01 
GeneralRe: Found this little gem in one of the applications Pin
OriginalGriff13-Dec-12 7:16
mvpOriginalGriff13-Dec-12 7:16 
GeneralRe: Found this little gem in one of the applications Pin
RugbyLeague13-Dec-12 7:24
memberRugbyLeague13-Dec-12 7:24 
GeneralRe: Found this little gem in one of the applications Pin
d@nish 13-Dec-12 7:35
member d@nish 13-Dec-12 7:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    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 |
Web01 | 2.8.171114.1 | Last Updated 24 Nov 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid