473,320 Members | 1,910 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

A level 4 warning shown only in release mode, not in debug mode

B.
We just recently move to code from VC++6 to VC++.NET 2005 and upgrade
the warning level from 3 to 4. In debug mode, we compile the
application with no warning no error, but when I build it in release
mode, there are quite few C4701 warnings and some C2679 errors. Note
that some of warning and error happens in debug mode as well and was
fixed. Anyone know why some of warning and error happens only in
release mode?

Sep 20 '06 #1
5 3187
"B." <gu*******@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
We just recently move to code from VC++6 to VC++.NET 2005 and upgrade
the warning level from 3 to 4. In debug mode, we compile the
application with no warning no error, but when I build it in release
mode, there are quite few C4701 warnings and some C2679 errors. Note
that some of warning and error happens in debug mode as well and was
fixed. Anyone know why some of warning and error happens only in
release mode?
Because those warnings are emitted by the optimizer, which is disabled
during debug builds. These are typically warnings that require the compiler
to do expensive data flow analysis that isn't done if the optimizer is
disabled.

-cd
Sep 20 '06 #2
B.

Carl Daniel [VC++ MVP] wrote:
>
Because those warnings are emitted by the optimizer, which is disabled
during debug builds. These are typically warnings that require the compiler
to do expensive data flow analysis that isn't done if the optimizer is
disabled.

-cd
Thanks Carl, it is the same reason for error? And as I mentioned, most
of same warnings are actually caught in debug mode, just few are only
happens in release mode. Any clue?

B.

Sep 21 '06 #3
B. wrote:
Carl Daniel [VC++ MVP] wrote:
>>
Because those warnings are emitted by the optimizer, which is
disabled during debug builds. These are typically warnings that
require the compiler to do expensive data flow analysis that isn't
done if the optimizer is disabled.

-cd

Thanks Carl, it is the same reason for error? And as I mentioned, most
of same warnings are actually caught in debug mode, just few are only
happens in release mode. Any clue?
OK, I had to go look up what a C2679 error is (it helps if you post actual
error messages - few people have them memorized!).

Anyway... No, it doesn't make sense that a body of code would have a C2679
error in a release build but not in a debug build. I'd have to guess that
there's some preprocessor voodoo going on that's actually leaving out some
vital code in the release build. I'd try to construct a minimal program
that reproduces that C2679 in release builds but not debug builds. Along
the way, you'll likely figure out what's really wrong, or you'll have a nice
repro case to submit with a bug report, since barring any other explaination
(like the #ifdef scenario), that definitely sounds like a compiler bug.

The C4701 error makes perfect sense as a release-only error since detection
of uninitialized variables does in fact require data flow analysis.

-cd
Sep 21 '06 #4
B.

Carl Daniel [VC++ MVP] wrote:
B. wrote:
Carl Daniel [VC++ MVP] wrote:
>
Because those warnings are emitted by the optimizer, which is
disabled during debug builds. These are typically warnings that
require the compiler to do expensive data flow analysis that isn't
done if the optimizer is disabled.

-cd
Thanks Carl, it is the same reason for error? And as I mentioned, most
of same warnings are actually caught in debug mode, just few are only
happens in release mode. Any clue?

OK, I had to go look up what a C2679 error is (it helps if you post actual
error messages - few people have them memorized!).

Anyway... No, it doesn't make sense that a body of code would have a C2679
error in a release build but not in a debug build. I'd have to guess that
there's some preprocessor voodoo going on that's actually leaving out some
vital code in the release build. I'd try to construct a minimal program
that reproduces that C2679 in release builds but not debug builds. Along
the way, you'll likely figure out what's really wrong, or you'll have a nice
repro case to submit with a bug report, since barring any other explaination
(like the #ifdef scenario), that definitely sounds like a compiler bug.

The C4701 error makes perfect sense as a release-only error since detection
of uninitialized variables does in fact require data flow analysis.

-cd
Hi Carl,

I should post the code for the C2679 error:
list<SomeObject>::iterator iter = NULL;
....... // do something
if (iter ==NULL)
......

Basically, we try to assign NULL to an list's iterator and compare NULL
with the iterator, both places produce a C2679 error in release mode,
but not in debug mode. error message:
error C2679: binary '=' : no operator found which takes a right-hand
operand of type 'int' (or there is no acceptable conversion)
C:\Program Files\Microsoft Visual Studio 8\VC\include\list(421): could
be 'std::list<_Ty>::_Iterator<_Secure_validation>
&std::list<_Ty>::_Iterator<_Secure_validation>::op erator =(const
std::list<_Ty>::_Iterator<_Secure_validation&)'

I am pretty sure that it is not related to preprocessor, and I can fix
it, but just don't know why the error is only in release mode.

Sep 21 '06 #5
"B." <gu*******@gmail.comwrote in message
news:11**********************@d34g2000cwd.googlegr oups.com...
Hi Carl,

I should post the code for the C2679 error:
list<SomeObject>::iterator iter = NULL;
...... // do something
if (iter ==NULL)
.....

Basically, we try to assign NULL to an list's iterator and compare NULL
with the iterator, both places produce a C2679 error in release mode,
but not in debug mode. error message:
error C2679: binary '=' : no operator found which takes a right-hand
operand of type 'int' (or there is no acceptable conversion)
C:\Program Files\Microsoft Visual Studio 8\VC\include\list(421): could
be 'std::list<_Ty>::_Iterator<_Secure_validation>
&std::list<_Ty>::_Iterator<_Secure_validation>::op erator =(const
std::list<_Ty>::_Iterator<_Secure_validation&)'

I am pretty sure that it is not related to preprocessor, and I can fix
it, but just don't know why the error is only in release mode.
Ah ha!

Actually, it is releated to the preprocessor, but not in your code.

You cannot assign NULL to an interator, nor compare an iterators value to
NULL - whether such expressions "work" is implementation defined (i.e. not
guaranteed by the standard).

You need to re-work your code to not rely on being able to assign null to an
iterator.

-cd
Sep 21 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Phil Jollans | last post by:
Hi, I have an error dialog which shows the stack trace, usually without line numbers in the release version. To try to diagnose a particular problem, I have provided a user with a debug version...
3
by: Robert Rotstein | last post by:
It appears that exception handling at the top-most level of a C# program, in the static void Main() method, differs depending on whether the program is run in debug mode or not. That is, code such...
3
by: Bill Burris | last post by:
How do I find what is causing this warning from the Linker? If I use /NODEFAULTLIB I get hundreds of undefined symbols. LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other...
7
by: Srinivasa Rao | last post by:
I have read in one article that when we compile the application in release mode, all the debug classes and properties will be automatically removed from the code. I tried to implement this thing by...
3
by: Haldun ALIML | last post by:
Suppose that you have below property in some class, #if DEBUG public string DebugInfo { get { return "INDEX : " + _name + "\n" + "Index Owner : " + _owner.Name + "\n" + "Index Column Count:...
0
by: B. | last post by:
We just recently move to code from VC++6 to VC++.NET 2005 and upgrade the warning level from 3 to 4. In debug mode, we compile the application with no warning no error, but when I build it in...
7
by: news.microsoft.com | last post by:
I have an asp.net 2.0 project that when I change the build configuration to release I get the following error: Command line error BC2014: the value 'None' is invalid for option 'debug'. If I...
2
by: Dave Johansen | last post by:
I just converted a solution from Visual Studio 2003 to Visual Studio 2005 and the Debug mode seems to be running just fine, but the Release mode crashes on the following code: std::ifstream...
0
by: =?Utf-8?B?SmVmLnB0Yw==?= | last post by:
Hi, I am currently facing exactly the same issue with Visual Studio 2005. Did you find a way to solve this problem ? "AntonioSACE" wrote:
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.