Click here to Skip to main content
15,895,084 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.

 
GeneralReport Formatting?? Pin
Oscar Bowyer7-Mar-08 18:12
Oscar Bowyer7-Mar-08 18:12 
GeneralRe: Report Formatting?? Pin
Colin Angus Mackay8-Mar-08 12:38
Colin Angus Mackay8-Mar-08 12:38 
GeneralRe: Report Formatting?? Pin
Pete O'Hanlon10-Mar-08 10:59
mvePete O'Hanlon10-Mar-08 10:59 
GeneralWhat "for" ? Pin
Rage7-Mar-08 2:21
professionalRage7-Mar-08 2:21 
GeneralRe: What "for" ? Pin
CPallini7-Mar-08 2:36
mveCPallini7-Mar-08 2:36 
AnswerRe: What "for" ? Pin
Doc Lobster7-Mar-08 2:50
Doc Lobster7-Mar-08 2:50 
GeneralRe: What "for" ? Pin
leppie7-Mar-08 3:23
leppie7-Mar-08 3:23 
GeneralRe: What "for" ? PinPopular
MrMarco7-Mar-08 3:05
MrMarco7-Mar-08 3:05 
That's the answer from one of my workmates:


That's a workaround for one of the more braindead shortcomings of
Microsoft Visual C++ 6.

In ISO/ANSI C++, if you declare a loop variable inside a for-statement,
that variable goes out of scope at the end of the loop, i.e. you can
do this:

for ( int i = 0; i < x; ++i )<br />
{<br />
  // Code<br />
}<br />
for ( int i = 0; i < y; ++i )<br />
{<br />
  // Code<br />
}


MSVC 6 chokes on this - "variable redefinition". The macro you see is
a workaround for this, "forcing" the loop variable into the else-scope
(which MSVC 6 handles correctly).
GeneralRe: What "for" ? Pin
Dan Neely7-Mar-08 3:13
Dan Neely7-Mar-08 3:13 
GeneralRe: What "for" ? Pin
DevSolar7-Mar-08 3:49
DevSolar7-Mar-08 3:49 
GeneralRe: What "for" ? Pin
Dan Neely7-Mar-08 3:58
Dan Neely7-Mar-08 3:58 
GeneralRe: What "for" ? Pin
Paul Conrad7-Mar-08 11:04
professionalPaul Conrad7-Mar-08 11:04 
GeneralRe: What "for" ? Pin
QuiJohn7-Mar-08 3:17
QuiJohn7-Mar-08 3:17 
GeneralRe: What "for" ? Pin
leppie7-Mar-08 3:21
leppie7-Mar-08 3:21 
GeneralRe: What "for" ? Pin
Rage7-Mar-08 4:30
professionalRage7-Mar-08 4:30 
GeneralRe: What "for" ? Pin
Nemanja Trifunovic7-Mar-08 4:40
Nemanja Trifunovic7-Mar-08 4:40 
GeneralRe: What "for" ? Pin
Nemanja Trifunovic7-Mar-08 4:38
Nemanja Trifunovic7-Mar-08 4:38 
GeneralRe: What "for" ? Pin
Aamir Butt18-Mar-08 1:09
Aamir Butt18-Mar-08 1:09 
GeneralRe: What "for" ? Pin
fat_boy15-Apr-08 4:42
fat_boy15-Apr-08 4:42 
GeneralRe: What "for" ? Pin
Rob Grainger14-May-08 10:28
Rob Grainger14-May-08 10:28 
GeneralRe: What "for" ? Pin
leppie7-Mar-08 3:20
leppie7-Mar-08 3:20 
GeneralRe: What "for" ? Pin
Paul Conrad7-Mar-08 11:03
professionalPaul Conrad7-Mar-08 11:03 
GeneralHorror, or not? Pin
Philip Laureano26-Feb-08 22:10
Philip Laureano26-Feb-08 22:10 
GeneralRe: Horror, or not? Pin
darkelv26-Feb-08 22:48
darkelv26-Feb-08 22:48 
GeneralRe: Horror, or not? Pin
Vasudevan Deepak Kumar27-Feb-08 1:13
Vasudevan Deepak Kumar27-Feb-08 1:13 

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.