Strange bug in Release mode

Started by
14 comments, last by violentrevolution 11 years, 3 months ago

If i'm not mistaken, i believe it's actually because you don't use the vector.

Being in release mode you are not permitted to declare variables/methods without actually using them.

Advertisement
If i'm not mistaken, i believe it's actually because you don't use the vector.

Being in release mode you are not permitted to declare variables/methods without actually using them.

That's just... wrong. You're absolutely allowed to have variables and methods that you never use. The compiler is free to remove them (to some degree), but merely having them itself is not an error in any way.

[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
If i'm not mistaken, i believe it's actually because you don't use the vector.

Being in release mode you are not permitted to declare variables/methods without actually using them.

That's just... wrong. You're absolutely allowed to have variables and methods that you never use. The compiler is free to remove them (to some degree), but merely having them itself is not an error in any way.

In most languages, at least. In Go, for instance, declaring unused variables is an error. But for C++, you can of course declare placeholder variables which you aren't actually using yet, the compiler will simply ignore them (usually). At least with correct code, adding extra unused variables should not change the program's observable behaviour.

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

If i'm not mistaken, i believe it's actually because you don't use the vector.

Being in release mode you are not permitted to declare variables/methods without actually using them.

That's just... wrong. You're absolutely allowed to have variables and methods that you never use. The compiler is free to remove them (to some degree), but merely having them itself is not an error in any way.

In most languages, at least. In Go, for instance, declaring unused variables is an error. But for C++, you can of course declare placeholder variables which you aren't actually using yet, the compiler will simply ignore them (usually). At least with correct code, adding extra unused variables should not change the program's observable behaviour.

So long as their construction/destruction has no global side-effects.

The last time Ive had a bug like this it was becasuse the debug mode did additional things like initializing variables to NULL. ....in debug mode everything was fine but in "normal" mode it produced a weird error.

Clean and Rebuild may have worked because the dependent library, that is associated with the class, might be built previously in debug mode, and since you just switched to Release and rebuilt, it might not have been picked up appropriately. For Release builds, all the dependencies should also be built in release mode, otherwise it won't work.

This topic is closed to new replies.

Advertisement