Click here to Skip to main content
15,889,931 members

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.

 
GeneralRe: For loop Pin
Chris-Kaiser15-Mar-07 12:37
Chris-Kaiser15-Mar-07 12:37 
GeneralRe: For loop Pin
PIEBALDconsult13-Mar-07 8:13
mvePIEBALDconsult13-Mar-07 8:13 
GeneralRe: For loop Pin
ricecake14-Mar-07 3:29
ricecake14-Mar-07 3:29 
GeneralRe: For loop Pin
Johann Gerell14-Mar-07 22:55
Johann Gerell14-Mar-07 22:55 
JokeRe: For loop Pin
Marcus J. Smith13-Mar-07 4:01
professionalMarcus J. Smith13-Mar-07 4:01 
GeneralRe: For loop Pin
Ennis Ray Lynch, Jr.13-Mar-07 4:59
Ennis Ray Lynch, Jr.13-Mar-07 4:59 
GeneralRe: For loop Pin
reshi99913-Mar-07 5:54
reshi99913-Mar-07 5:54 
GeneralRe: For loop Pin
Daniel Turini13-Mar-07 10:23
Daniel Turini13-Mar-07 10:23 
for(int i=0;i<=7*2;i++)

I often do this kind of thing when I have well-known constants in my code (e.g., 7 days in a week, 2 possible bit values) that aren't worth something like:
#define DAYS_ON_WEEK 7
#define BIT_VALUES 2

But I only do this kind of thing for constants that are immutable and extremely obvious to the context (hey, sue me when bits can store something different from 0 and 1).
This way, writing 7*2 can be more readable than 14 and the compiler will output 14, anyways.





GeneralRe: For loop Pin
V.13-Mar-07 22:51
professionalV.13-Mar-07 22:51 
GeneralRe: For loop Pin
Captain See Sharp14-Mar-07 13:15
Captain See Sharp14-Mar-07 13:15 
JokeRe: For loop Pin
imagiro28-Apr-07 4:49
imagiro28-Apr-07 4:49 
JokeRe: For loop Pin
Sylvester george22-Jun-07 0:25
Sylvester george22-Jun-07 0:25 
GeneralIt always worked well before so leave it like that... [modified] Pin
Stephan Poirier12-Mar-07 21:04
Stephan Poirier12-Mar-07 21:04 
GeneralRe: It always worked well before so leave it like that... Pin
Hal Angseesing12-Mar-07 22:16
professionalHal Angseesing12-Mar-07 22:16 
GeneralRe: It always worked well before so leave it like that... Pin
Stephan Poirier13-Mar-07 17:26
Stephan Poirier13-Mar-07 17:26 
GeneralRe: It always worked well before so leave it like that... Pin
Emil - Gabriel12-Mar-07 22:35
Emil - Gabriel12-Mar-07 22:35 
GeneralRe: It always worked well before so leave it like that... Pin
Stephan Poirier13-Mar-07 17:21
Stephan Poirier13-Mar-07 17:21 
GeneralRe: It always worked well before so leave it like that... Pin
Stephen Hewitt13-Mar-07 2:25
Stephen Hewitt13-Mar-07 2:25 
GeneralRe: It always worked well before so leave it like that... Pin
Pete O'Hanlon13-Mar-07 5:56
mvePete O'Hanlon13-Mar-07 5:56 
GeneralRe: It always worked well before so leave it like that... Pin
PIEBALDconsult13-Mar-07 8:14
mvePIEBALDconsult13-Mar-07 8:14 
GeneralRe: It always worked well before so leave it like that... Pin
Stephan Poirier13-Mar-07 17:10
Stephan Poirier13-Mar-07 17:10 
GeneralRe: It always worked well before so leave it like that... Pin
Stephan Poirier13-Mar-07 17:11
Stephan Poirier13-Mar-07 17:11 
GeneralRe: It always worked well before so leave it like that... Pin
John R. Shaw14-Mar-07 17:13
John R. Shaw14-Mar-07 17:13 
GeneralRe: It always worked well before so leave it like that... Pin
Stephan Poirier14-Mar-07 17:52
Stephan Poirier14-Mar-07 17:52 
GeneralRe: It always worked well before so leave it like that... Pin
vijay_aroli15-Mar-07 0:59
vijay_aroli15-Mar-07 0:59 

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.