Bug Notice DevCpp 4.9.9.0

Started by
5 comments, last by daerid 19 years, 5 months ago
IDE: DevCpp 4.9.9.0; Compiler: mingw 3.3.1 I ran across this little bastard while I was working one of my projects

lpProgramMemory = &Memory[(PB*BANK_SIZE) +  PC];
    switch(*lpProgramMemory){  
//////////// ADC Add With Carry  \\\\\\\\\\\\
       case 0x61: // ADC (dp,X)    
	
	 . . // ..		


Here

///////////////// Processor Flags  \\\\\\\\\\\\\\\
BOOL bEmulation; // 6502 Emulation mode 8 bit;


And Here

//////////// Internal Registers \\\\\\\\\\\\\\\\\
WORD A;             // the Accumulator


The compiler told me that A, And bEumulation were both undeclared And that case 0x61 was unreachable, all of which were not true The culprit was the \\\ marks in the comments in the code


Won’t Work
//////////// ADC Add With Carry  \\\\\\\\\\\\
       case 0x61: // ADC (dp,X)    

Works 
//////////// ADC Add With Carry 
       case 0x61: // ADC (dp,X)    


weird huh? -Frank
Advertisement
That's not a bug in Dev C++ or MinGW, that's the fault of the programming language. The \ at the end of a line is a line continuation token, which means that if you have a \ at the end of a line, it makes that line part of the line with the \ at the end. That means that if you have a // style comment with a \ at the end of the line, it comments out the next line too.
backslash and the end of a line extends the comment to the following one.

Wow, That's about the dumbest thing I possible ever heard of.
Why in gods name would anyone ever for any reason think of implementing something like that into a programming language.
It's just asking for trouble.

This world is a sad sad place.

- Frank
It's one of the things C++ inherited from C, which had only /* */ style comments, so this kind of problem didn't come up. In particular, line continuation characters were designed to support preprocessor macro definitions.
I Know but it's in a comment So it should igonre it. That is in a sane world.


I think it's an over-sight on in the Dev-Cpp IDE a bug.

-Frank
Quote:Original post by FrankCashio
I think it's an over-sight on in the Dev-Cpp IDE a bug.

-Frank


It's not. It's characteristic of the language itself. just don't use those god-awful \\\\\\\\\\\\\\\ comments.
daerid@gmail.com

This topic is closed to new replies.

Advertisement