THIS_FILE' : redefinition; different storage class while changing setting from /MD to /MDD

Hi,
I  working in finding out the memory leak in the application which was
developed in vc++2005. I am using  _CrtMemCheckpoint function to  find
out the memory leak these function will be working only when the
application is in debug mode and the project setting should in /MDD
or /MTD .
When ever I change my setting from /MD to /MDD I get a compiler error
Error      251         error C2370: 'THIS_FILE' : redefinition;
different storage class
i.e   error is at
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
#pragma once
static char THIS_FILE[] = __FILE__;
#endif

When I try to remove this and build I can build the application but it
crashes .
Could you please help me out what is changes  I need to make to run
the application successfully.

Thanks in Advance,
Regards,
Girish
0
Girish
4/28/2010 7:20:14 AM
vc.mfc 33608 articles. 0 followers. Follow

12 Replies
1563 Views

Similar Articles

[PageSpeed] 17

On Apr 28, 9:20=A0am, Girish <giris...@gmail.com> wrote:
> Hi,
> I =A0working in finding out the memory leak in the application which was
> developed in vc++2005. I am using =A0_CrtMemCheckpoint function to =A0fin=
d
> out the memory leak these function will be working only when the
> application is in debug mode and the project setting should in /MDD
> or /MTD .
> When ever I change my setting from /MD to /MDD I get a compiler error
> Error =A0 =A0 =A0251 =A0 =A0 =A0 =A0 error C2370: 'THIS_FILE' : redefinit=
ion;
> different storage class
> i.e =A0 error is at
> #ifdef _DEBUG
> #define new DEBUG_NEW
> #undef THIS_FILE
> #pragma once
> static char THIS_FILE[] =3D __FILE__;
> #endif

We3ll, compiler is telling you that somehow you defined THIS_FILE more
than once. Without seeing all of the code you have, nobody can tell
where exactly is the problem. Is it possible that you put these macros
in a header file?

> When I try to remove this and build I can build the application but it
> crashes .

You have to tell people here what "crashes" mean more specifically.
You can gather much, much more info on "crashes". Where exactly is the
crash, in your sources? What is the crash? OS exception (e.g. access
violation) etc. How does your stack look like when crash occurs? Etc.

Don't be helpless. Look harder.

Goran.
0
Goran
4/28/2010 9:53:58 AM
Could you have this in more than one .h file where one is included in 
another so there really are two definitions?

Tom

"Girish" <girishog@gmail.com> wrote in message 
news:3acca237-b45f-49dd-ba84-49902867ffd8@h27g2000yqm.googlegroups.com...
> Hi,
> I  working in finding out the memory leak in the application which was
> developed in vc++2005. I am using  _CrtMemCheckpoint function to  find
> out the memory leak these function will be working only when the
> application is in debug mode and the project setting should in /MDD
> or /MTD .
> When ever I change my setting from /MD to /MDD I get a compiler error
> Error      251         error C2370: 'THIS_FILE' : redefinition;
> different storage class
> i.e   error is at
> #ifdef _DEBUG
> #define new DEBUG_NEW
> #undef THIS_FILE
> #pragma once
> static char THIS_FILE[] = __FILE__;
> #endif
>
> When I try to remove this and build I can build the application but it
> crashes .
> Could you please help me out what is changes  I need to make to run
> the application successfully.
>
> Thanks in Advance,
> Regards,
> Girish 

0
Tom
4/28/2010 11:31:09 AM
#undef does NOT undefine a symbol such as THIS_FILE; it can only undefine a symbol which
has been created by #define!  So I have no idea what you are expecting the undef to do.

If you had another definition of THIS_FILE somewhere, this second definition is in
conflict with it, and the #undef is just silly noise.

I have no idea why you would put a #pragma once in a .cpp file!  This is appropriate only
in header files, and it would NOT be conditioned under an #ifdef _DEBUG!   So I have no
idea what the intent of the code below might be, except that it is completely wrong in so
many ways I'm not surprised it gives errors.

Of course, the #pragma once might be because this code was placed in a header file, in
which case it is clearly wrong in yet a new way: it is defining a variable (THIS_FILE)
which has the WRONG file name (the name of the header file) and which will be included as
a static variable in every module of your code.

Also, when you quote error messages, it is useful to quote the entire message, which
includes the file name.  If you want to disguise the file name for proprietary reasons,
then replace the name (e.g., productname.h) with XXXXXXXX.h.  But since you chose to hide
the filename, I'm having to guess at what you did wrong.

Fix the nonsense code below, remove the #undef, put it in a .cpp file, and if the problem
is that the code is in your .h file, move the code to a .cpp file where it belongs.
					joe

On Wed, 28 Apr 2010 00:20:14 -0700 (PDT), Girish <girishog@gmail.com> wrote:

>Hi,
>I  working in finding out the memory leak in the application which was
>developed in vc++2005. I am using  _CrtMemCheckpoint function to  find
>out the memory leak these function will be working only when the
>application is in debug mode and the project setting should in /MDD
>or /MTD .
>When ever I change my setting from /MD to /MDD I get a compiler error
>Error      251         error C2370: 'THIS_FILE' : redefinition;
>different storage class
>i.e   error is at
>#ifdef _DEBUG
>#define new DEBUG_NEW
>#undef THIS_FILE
>#pragma once
>static char THIS_FILE[] = __FILE__;
>#endif
>
>When I try to remove this and build I can build the application but it
>crashes .
>Could you please help me out what is changes  I need to make to run
>the application successfully.
>
>Thanks in Advance,
>Regards,
>Girish
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
Joseph
4/28/2010 1:10:36 PM
On Apr 28, 1:20=A0am, Girish <giris...@gmail.com> wrote:
> Hi,
> I =A0working in finding out the memory leak in the application which was
> developed in vc++2005. I am using =A0_CrtMemCheckpoint function to =A0fin=
d
> out the memory leak these function will be working only when the
> application is in debug mode and the project setting should in /MDD
> or /MTD .
> When ever I change my setting from /MD to /MDD I get a compiler error
> Error =A0 =A0 =A0251 =A0 =A0 =A0 =A0 error C2370: 'THIS_FILE' : redefinit=
ion;
> different storage class
> i.e =A0 error is at
> #ifdef _DEBUG
> #define new DEBUG_NEW
> #undef THIS_FILE
> #pragma once
> static char THIS_FILE[] =3D __FILE__;
> #endif
>
> When I try to remove this and build I can build the application but it
> crashes .
> Could you please help me out what is changes =A0I need to make to run
> the application successfully.
>
> Thanks in Advance,
> Regards,
> Girish

Girish, for what it's worth, all of my cpp files (created by earlier
versions of MFC), have this code near the top (and compiles fine with
debug or release builds):

#ifdef _DEBUG
#define new DEBUG_NEW

#undef THIS_FILE
static char THIS_FILE[] =3D __FILE__;
#endif

Not the pragma you showed. And so to Joe, the undef THIS_FILE was put
there by MFC...

As to finding your memory leak, I sometimes resort to the caveman-like
approach of removing blocks of code. I save a copy of my source code
(the entire folder), delete a big chunk of code (that will still allow
my app to run), see if it still leaks, and repeat until I can narrow
down what is causing the leak. This approach isn't guaranteed to
isolate the problem, but it usually works for me.

0
Steve
4/28/2010 1:34:08 PM
This article may also be useful to OP:

http://www.codeproject.com/kb/cpp/MemLeakDetect.aspx

I've, like you, often resort to the brute force method, just using Task 
Manager and looking for blocks in the debug build that show up at the end of 
the run in the Output window and things like that...

Tom

"Steve Achelis" <info@RescueRigger.com> wrote in message 
news:7cb36cd1-fdec-4b19-8957-51d2afcf985a@u30g2000prd.googlegroups.com...
> On Apr 28, 1:20 am, Girish <giris...@gmail.com> wrote:
>> Hi,
>> I  working in finding out the memory leak in the application which was
>> developed in vc++2005. I am using  _CrtMemCheckpoint function to  find
>> out the memory leak these function will be working only when the
>> application is in debug mode and the project setting should in /MDD
>> or /MTD .
>> When ever I change my setting from /MD to /MDD I get a compiler error
>> Error      251         error C2370: 'THIS_FILE' : redefinition;
>> different storage class
>> i.e   error is at
>> #ifdef _DEBUG
>> #define new DEBUG_NEW
>> #undef THIS_FILE
>> #pragma once
>> static char THIS_FILE[] = __FILE__;
>> #endif
>>
>> When I try to remove this and build I can build the application but it
>> crashes .
>> Could you please help me out what is changes  I need to make to run
>> the application successfully.
>>
>> Thanks in Advance,
>> Regards,
>> Girish
>
> Girish, for what it's worth, all of my cpp files (created by earlier
> versions of MFC), have this code near the top (and compiles fine with
> debug or release builds):
>
> #ifdef _DEBUG
> #define new DEBUG_NEW
>
> #undef THIS_FILE
> static char THIS_FILE[] = __FILE__;
> #endif
>
> Not the pragma you showed. And so to Joe, the undef THIS_FILE was put
> there by MFC...
>
> As to finding your memory leak, I sometimes resort to the caveman-like
> approach of removing blocks of code. I save a copy of my source code
> (the entire folder), delete a big chunk of code (that will still allow
> my app to run), see if it still leaks, and repeat until I can narrow
> down what is causing the leak. This approach isn't guaranteed to
> isolate the problem, but it usually works for me.
> 
0
Tom
4/28/2010 1:45:57 PM
Why do you have the

      #pragma once?

Just use this:

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

I just checked something. If you have to use CrtMemCheckpoint, then 
you are not MFC ready.

I have a lot of test and design code that are console only, where I 
will isolate a new class and do rapid development and testing under my 
programmer editor.

To use the crtdbg.h, here is an example test code using this crtdbg 
facility:

---------------------- CUT HERE --------------------------
// File: testurl.cpp
//
// cl testurl.cpp  /W3 /EHsc /MDd /D /Zi /Od /D "WINVER=0x500"
//                 /D "WIN32" /D "_DEBUG" /D "_WINDOWS"
//                 /FR /link /debug
//

#include <stdio.h>
#include <windows.h>

#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#endif

#include "url.cpp" // new URL parser

void ParseUrl(const char *str)
{
    URL *url = urlparse(str);
    printf("- %4s URL: %s\n", url?"GOOD":"BAD", str);
    if (url) urlfree(url);
}

void main(char argc, char *argv[])
{
#ifdef _DEBUG
    _CrtMemState memstate1;
    _CrtMemState memstate2, memdiff;

    // Send all reports to STDOUT
    _CrtSetReportMode( _CRT_WARN,    _CRTDBG_MODE_FILE );
    _CrtSetReportFile( _CRT_WARN,    _CRTDBG_FILE_STDOUT );
    _CrtSetReportMode( _CRT_ERROR,   _CRTDBG_MODE_FILE );
    _CrtSetReportFile( _CRT_ERROR,   _CRTDBG_FILE_STDOUT );
    _CrtSetReportMode( _CRT_ASSERT,  _CRTDBG_MODE_FILE );
    _CrtSetReportFile( _CRT_ASSERT,  _CRTDBG_FILE_STDOUT );

    _CrtMemCheckpoint(&memstate1);
#endif

    ParseUrl("/public/test1.php?title=special:123");
    ParseUrl("/public/test1.php?title=special/page_name");
    ParseUrl("/public/test1.php?title=special:123/page_name");
    ParseUrl("/public/test1.php?/title=special:123/page_name");

#ifdef _DEBUG
    _CrtMemCheckpoint(&memstate2);
    if ( _CrtMemDifference( &memdiff, &memstate1, &memstate2 )) {
       printf("***** MEM LEAK *******\n");
       _CrtMemDumpStatistics( &memdiff);
       _CrtMemDumpAllObjectsSince(&memdiff);
       _CrtDumpMemoryLeaks();
    }
#endif
}
---------------------- CUT HERE --------------------------

Girish wrote:

> Hi,
> I  working in finding out the memory leak in the application which was
> developed in vc++2005. I am using  _CrtMemCheckpoint function to  find
> out the memory leak these function will be working only when the
> application is in debug mode and the project setting should in /MDD
> or /MTD .
> When ever I change my setting from /MD to /MDD I get a compiler error
> Error      251         error C2370: 'THIS_FILE' : redefinition;
> different storage class
> i.e   error is at
> #ifdef _DEBUG
> #define new DEBUG_NEW
> #undef THIS_FILE
> #pragma once
> static char THIS_FILE[] = __FILE__;
> #endif
> 
> When I try to remove this and build I can build the application but it
> crashes .
> Could you please help me out what is changes  I need to make to run
> the application successfully.
> 
> Thanks in Advance,
> Regards,
> Girish



-- 
HLS
0
Hector
4/28/2010 5:38:12 PM
I have no idea why MFC would put an #undef in, unless some earlier version had defined
THIS_FILE as a macro.  But given the poor quality of information we were given about the
problem (it didn't even say which file issued the error message!  Or which file had the
code!) it is hard to play psychic detective and guess what is going on.
				joe

On Wed, 28 Apr 2010 06:34:08 -0700 (PDT), Steve Achelis <info@RescueRigger.com> wrote:

>On Apr 28, 1:20�am, Girish <giris...@gmail.com> wrote:
>> Hi,
>> I �working in finding out the memory leak in the application which was
>> developed in vc++2005. I am using �_CrtMemCheckpoint function to �find
>> out the memory leak these function will be working only when the
>> application is in debug mode and the project setting should in /MDD
>> or /MTD .
>> When ever I change my setting from /MD to /MDD I get a compiler error
>> Error � � �251 � � � � error C2370: 'THIS_FILE' : redefinition;
>> different storage class
>> i.e � error is at
>> #ifdef _DEBUG
>> #define new DEBUG_NEW
>> #undef THIS_FILE
>> #pragma once
>> static char THIS_FILE[] = __FILE__;
>> #endif
>>
>> When I try to remove this and build I can build the application but it
>> crashes .
>> Could you please help me out what is changes �I need to make to run
>> the application successfully.
>>
>> Thanks in Advance,
>> Regards,
>> Girish
>
>Girish, for what it's worth, all of my cpp files (created by earlier
>versions of MFC), have this code near the top (and compiles fine with
>debug or release builds):
>
>#ifdef _DEBUG
>#define new DEBUG_NEW
>
>#undef THIS_FILE
>static char THIS_FILE[] = __FILE__;
>#endif
>
>Not the pragma you showed. And so to Joe, the undef THIS_FILE was put
>there by MFC...
>
>As to finding your memory leak, I sometimes resort to the caveman-like
>approach of removing blocks of code. I save a copy of my source code
>(the entire folder), delete a big chunk of code (that will still allow
>my app to run), see if it still leaks, and repeat until I can narrow
>down what is causing the leak. This approach isn't guaranteed to
>isolate the problem, but it usually works for me.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
Joseph
4/28/2010 10:32:52 PM
Hi All,
First I need to say thanks for every one for proving your ideas.
I got the solution for the problem which i was facing.

by setting the below variables to 0

#define _HAS_ITERATOR_DEBUGGING 0
#define _SECURE_SCL 0

after define this we can remove  the  below code and build the
application with out any error or any crash.

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
#pragma once
static char THIS_FILE[] =3D __FILE__;
#endif


Regards,
Girish




On Apr 29, 3:32=A0am, Joseph M. Newcomer <newco...@flounder.com> wrote:
> I have no idea why MFC would put an #undef in, unless some earlier versio=
n had defined
> THIS_FILE as a macro. =A0But given the poor quality of information we wer=
e given about the
> problem (it didn't even say which file issued the error message! =A0Or wh=
ich file had the
> code!) it is hard to play psychic detective and guess what is going on.
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 joe
>
>
>
>
>
> On Wed, 28 Apr 2010 06:34:08 -0700 (PDT), Steve Achelis <i...@RescueRigge=
r.com> wrote:
> >On Apr 28, 1:20=A0am, Girish <giris...@gmail.com> wrote:
> >> Hi,
> >> I =A0working in finding out the memory leak in the application which w=
as
> >> developed in vc++2005. I am using =A0_CrtMemCheckpoint function to =A0=
find
> >> out the memory leak these function will be working only when the
> >> application is in debug mode and the project setting should in /MDD
> >> or /MTD .
> >> When ever I change my setting from /MD to /MDD I get a compiler error
> >> Error =A0 =A0 =A0251 =A0 =A0 =A0 =A0 error C2370: 'THIS_FILE' : redefi=
nition;
> >> different storage class
> >> i.e =A0 error is at
> >> #ifdef _DEBUG
> >> #define new DEBUG_NEW
> >> #undef THIS_FILE
> >> #pragma once
> >> static char THIS_FILE[] =3D __FILE__;
> >> #endif
>
> >> When I try to remove this and build I can build the application but it
> >> crashes .
> >> Could you please help me out what is changes =A0I need to make to run
> >> the application successfully.
>
> >> Thanks in Advance,
> >> Regards,
> >> Girish
>
> >Girish, for what it's worth, all of my cpp files (created by earlier
> >versions of MFC), have this code near the top (and compiles fine with
> >debug or release builds):
>
> >#ifdef _DEBUG
> >#define new DEBUG_NEW
>
> >#undef THIS_FILE
> >static char THIS_FILE[] =3D __FILE__;
> >#endif
>
> >Not the pragma you showed. And so to Joe, the undef THIS_FILE was put
> >there by MFC...
>
> >As to finding your memory leak, I sometimes resort to the caveman-like
> >approach of removing blocks of code. I save a copy of my source code
> >(the entire folder), delete a big chunk of code (that will still allow
> >my app to run), see if it still leaks, and repeat until I can narrow
> >down what is causing the leak. This approach isn't guaranteed to
> >isolate the problem, but it usually works for me.
>
> Joseph M. Newcomer [MVP]
> email: newco...@flounder.com
> Web:http://www.flounder.com
> MVP Tips:http://www.flounder.com/mvp_tips.htm

0
Girish
4/30/2010 7:12:50 AM
While changing the project  setting from /md to /mdd or /mt to /mtd we
should make sure that all the dependency  dll and modules are in the
same form i.e in debug mode  if not then we would be facing this type
of problem .
in this case we could not use some of debugging functions like
_CrtMemCheckpoint to use this type function we need to define
#define _HAS_ITERATOR_DEBUGGING 0
#define _SECURE_SCL 0

which could give some ASSERT msg which would not crash be an issue.

Regards,
Girish

On Apr 28, 10:38=A0pm, Hector Santos <sant9...@nospam.gmail.com> wrote:
> Why do you have the
>
> =A0 =A0 =A0 #pragma once?
>
> Just use this:
>
> #ifdef _DEBUG
> #define new DEBUG_NEW
> #endif
>
> I just checked something. If you have to use CrtMemCheckpoint, then
> you are not MFC ready.
>
> I have a lot of test and design code that are console only, where I
> will isolate a new class and do rapid development and testing under my
> programmer editor.
>
> To use the crtdbg.h, here is an example test code using this crtdbg
> facility:
>
> ---------------------- CUT HERE --------------------------
> // File: testurl.cpp
> //
> // cl testurl.cpp =A0/W3 /EHsc /MDd /D /Zi /Od /D "WINVER=3D0x500"
> // =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /D "WIN32" /D "_DEBUG" /D "_WINDOWS"
> // =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /FR /link /debug
> //
>
> #include <stdio.h>
> #include <windows.h>
>
> #ifdef _DEBUG
> #define _CRTDBG_MAP_ALLOC
> #include <crtdbg.h>
> #endif
>
> #include "url.cpp" // new URL parser
>
> void ParseUrl(const char *str)
> {
> =A0 =A0 URL *url =3D urlparse(str);
> =A0 =A0 printf("- %4s URL: %s\n", url?"GOOD":"BAD", str);
> =A0 =A0 if (url) urlfree(url);
>
> }
>
> void main(char argc, char *argv[])
> {
> #ifdef _DEBUG
> =A0 =A0 _CrtMemState memstate1;
> =A0 =A0 _CrtMemState memstate2, memdiff;
>
> =A0 =A0 // Send all reports to STDOUT
> =A0 =A0 _CrtSetReportMode( _CRT_WARN, =A0 =A0_CRTDBG_MODE_FILE );
> =A0 =A0 _CrtSetReportFile( _CRT_WARN, =A0 =A0_CRTDBG_FILE_STDOUT );
> =A0 =A0 _CrtSetReportMode( _CRT_ERROR, =A0 _CRTDBG_MODE_FILE );
> =A0 =A0 _CrtSetReportFile( _CRT_ERROR, =A0 _CRTDBG_FILE_STDOUT );
> =A0 =A0 _CrtSetReportMode( _CRT_ASSERT, =A0_CRTDBG_MODE_FILE );
> =A0 =A0 _CrtSetReportFile( _CRT_ASSERT, =A0_CRTDBG_FILE_STDOUT );
>
> =A0 =A0 _CrtMemCheckpoint(&memstate1);
> #endif
>
> =A0 =A0 ParseUrl("/public/test1.php?title=3Dspecial:123");
> =A0 =A0 ParseUrl("/public/test1.php?title=3Dspecial/page_name");
> =A0 =A0 ParseUrl("/public/test1.php?title=3Dspecial:123/page_name");
> =A0 =A0 ParseUrl("/public/test1.php?/title=3Dspecial:123/page_name");
>
> #ifdef _DEBUG
> =A0 =A0 _CrtMemCheckpoint(&memstate2);
> =A0 =A0 if ( _CrtMemDifference( &memdiff, &memstate1, &memstate2 )) {
> =A0 =A0 =A0 =A0printf("***** MEM LEAK *******\n");
> =A0 =A0 =A0 =A0_CrtMemDumpStatistics( &memdiff);
> =A0 =A0 =A0 =A0_CrtMemDumpAllObjectsSince(&memdiff);
> =A0 =A0 =A0 =A0_CrtDumpMemoryLeaks();
> =A0 =A0 }
> #endif}
>
> ---------------------- CUT HERE --------------------------
>
>
>
>
>
> Girish wrote:
> > Hi,
> > I =A0working in finding out the memory leak in the application which wa=
s
> > developed in vc++2005. I am using =A0_CrtMemCheckpoint function to =A0f=
ind
> > out the memory leak these function will be working only when the
> > application is in debug mode and the project setting should in /MDD
> > or /MTD .
> > When ever I change my setting from /MD to /MDD I get a compiler error
> > Error =A0 =A0 =A0251 =A0 =A0 =A0 =A0 error C2370: 'THIS_FILE' : redefin=
ition;
> > different storage class
> > i.e =A0 error is at
> > #ifdef _DEBUG
> > #define new DEBUG_NEW
> > #undef THIS_FILE
> > #pragma once
> > static char THIS_FILE[] =3D __FILE__;
> > #endif
>
> > When I try to remove this and build I can build the application but it
> > crashes .
> > Could you please help me out what is changes =A0I need to make to run
> > the application successfully.
>
> > Thanks in Advance,
> > Regards,
> > Girish
>
> --
> HLS

0
Girish
4/30/2010 7:18:55 AM
Hello,

Girish wrote:
> Hi All,
> First I need to say thanks for every one for proving your ideas.
> I got the solution for the problem which i was facing.
> by setting the below variables to 0
> 
> #define _HAS_ITERATOR_DEBUGGING 0
> #define _SECURE_SCL 0
> 
> after define this we can remove  the  below code and build the
> application with out any error or any crash.
> 
> #ifdef _DEBUG
> #define new DEBUG_NEW
> #undef THIS_FILE
> #pragma once
> static char THIS_FILE[] = __FILE__;
> #endif

So you solved it by removing certain debug and error checks!?

Best regards,

Oliver
0
Oliver
4/30/2010 9:45:20 AM
See below...
On Fri, 30 Apr 2010 11:45:20 +0200, Oliver Regenfelder <oliver.regenfelder@gmx.at> wrote:

>Hello,
>
>Girish wrote:
>> Hi All,
>> First I need to say thanks for every one for proving your ideas.
>> I got the solution for the problem which i was facing.
>> by setting the below variables to 0
>> 
>> #define _HAS_ITERATOR_DEBUGGING 0
>> #define _SECURE_SCL 0
>> 
>> after define this we can remove  the  below code and build the
>> application with out any error or any crash.
>> 
>> #ifdef _DEBUG
>> #define new DEBUG_NEW
>> #undef THIS_FILE
>> #pragma once
>> static char THIS_FILE[] = __FILE__;
>> #endif
>
>So you solved it by removing certain debug and error checks!?
****
In an (in)famous incident, the story goes, a torpedo was made "safe" by the following
technique:

One on the serious dangers to a submarine is having its own torpedo loop back and acquire
its sending submarine as a target.  So a "safe" torpedo was created that had an inertial
platform, and if the torpedo every executed a 180-degree turn it would detonate.

During the testing, a torpedo with a small dummy warhead was taken out on trial.  Due to
some mechanical failure in the torpedo tube, the torpedo jammed in the tube.  After
several attempts to dislodge it, the submarine turned to head back to port.

Also, while the torpedo had not launched, its safety systems were activated.  The torpedo
did as it was supposed to, and exploded.

Because the warhead was a small dummy load, it did not destroy the submarine, but caused
several million dollars in damage.

This taught the torpedo designers a lesson.  The next torpedo had a LOT of safety software
in it.  They took it out on trial.  They fired it.  As soon as it left the tube, all the
safety software enabled (no detonation in the tube) but what happened was the motor then
stopped and torpedo sank to the bottom of the ocean.

Moral: removing safety code is bad; putting in too much is worse.

Unfortunately, the way this was solved was simply by removing more and more safety code
until the torpedo actually appeared to work.  Very little effort was expended in
determining if the safety code that was removed compromised ACTUAL safety.  Sort of a
hack-and-try approach was used.  It was then that some of the world's experits in software
safety were called in to do a review of the software.  They were appalled at what they
found, but because of National Security Considerations can neither disclose what they
found nor discuss what they did to correct it.  So the story above is pretty much all they
can give (I learned this from one of the software safety experts, at a conference on
software safety)

Does anyone remember "Diamond" brand graphics cards?  A few of us had them, but Diamond,
to make performance goals, got rid of a lot of code that contributed nothing to the
performance, such as bounds checking, parameter validation, etc.,  This is approximately
the phone call I had with them:

"...and every time I zoom into a slide in PowerPoint, Windows bluescreens"

"Well sir, do you have the latest build of the driver?"

"Yes, I downloaded it today."

"What timestmp does it have?"

<<Pause while I bring up the file manager and look at the timestamp>>

"[A little after 10am] today"

"Then you don't have the latest build.  You need the 2pm release"

Shortly after that, I went out and bought a different brand of card.  Diamond Video
shortly thereafter went out of business, because no one EVER bought a second card from
them, and those who paid attention to the newsgroups in which it was discussed never
bought a first card from them (lucky users!)

You need really good reasons for disabling safety code.  Only if your torpedo sinks
immediately after launch is this justified.  And then, it must be done with care.  It is
more important to find out why you are getting failures than to just disable the safety
code and hope nothing goes wrong.
****
>
>Best regards,
>
>Oliver
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
Joseph
4/30/2010 4:36:11 PM
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
news:em0mt5dj2sffkthgurcsg25mvmplq9hh8m@4ax.com...
> Does anyone remember "Diamond" brand graphics cards?  A few of us had 
> them, but Diamond,
> to make performance goals, got rid of a lot of code that contributed 
> nothing to the
> performance, such as bounds checking, parameter validation, etc.,  This is 
> approximately
> the phone call I had with them:
>

That is funny.  I also lost money on them when I bought the Diamond Viper 
which was the fastest card for Windows 3.1, but due to 'architectural 
limitations' they could not deliver a Win 95 driver in 3 attempts.

-- David 

0
David
4/30/2010 10:48:39 PM
Reply:

Similar Artilces:

Web Site built with Front Page-how do I change html remotely
I am taking over a website built with an older version of Front Page. I would like to be able to do some of the maitenance from my home computer, and know a little basic html. The site is hosted by godaddy.com I can log on godaddy and see the file content, but cannot see the html. Any help? "VAAFM" <VAAFM@discussions.microsoft.com> wrote in message news:120FEAE1-A8AA-4D34-872B-61E121EA6BDC@microsoft.com... >I am taking over a website built with an older version of Front Page. I >would > like to be able to do some of the maitenance from my home computer, a...

Change Pictures as Attachmnet
Since I've updated to Outlook 2002, everytime I send an e- mail and attach a picture, the picture is shown in the message, bigger that life. Before, when sending a picture with a message, the reciepient had to click on the attachment to open the picture. What do I have to do in order to send pictures in this manner? Thanks Craig ...

Saving different Docs on different locations
I have two documents as a template which I want to save on different locations For example Book1 template I want to save always on location D:/xxx/yyyy and Book2 template always on location E:/xxx/yyy Has anybody have an idea how can I solve this problem? Thanks in advance -- Spiridon ------------------------------------------------------------------------ Spiridon's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=34628 View this thread: http://www.excelforum.com/showthread.php?threadid=544468 How about this? Instead of using real templates (*.xlt), use a nor...

Role Home Page
How can I show my users upcoming appointments that are held in a Public Calendar? My initial thought is that this would be a part of the Role Homepage, and the Public Folder shown would be different for different roles. But I don't see a way to do show a public folder at all. Thanks in advance Douglas Genne ...

Unable to view Settings side tab
I'm new to CRM and just loaded up a VPC to try it out. I logged into the VPC as an admin user so that I could check out the Settings area and look through the customization options. Unfortunately there was no "Bar" on the side tab for "Settings" and the menu option for getting "Settings" to display does not seem to work. Anyone else experienced this? Any suggestions for tracking down the issue? Do a search on these forums - this has been covered multiple times now. "Darren Neimke" wrote: > I'm new to CRM and just loaded up a VPC to ...

Entry data sheet automaticlly updates or adds data to differant sh
I have a workbook with several sheets these sheets are all the same eccept for the title. Colunms are Name, heat one, heat two, heat three, total. then I have a sheet that the colunms are Name, total How can I make the last sheet with the Name, and total more automatated. I would like for the Name colunm to be a dropdown of some sort to where it looks at all the other sheets for names when you see the name you want you click it. it then fills in the field with that name and puts the total from the sheet where the name came from in the total field. I could provide the xls file if ...

Making a deposit from different checks at once
I have been wondering if this is possible for a long time because it is kind of annoying. Sometimes I will deposit multiple checks at once from different sources. I know you can do a split category and enter a different category for each check, but is there a way to enter a different "From" line for each check if they are lumped into one deposit? Anyone have any ways around this? Thanks. The memo field or separate transactions are pretty much the choices. "Dan" <dmangi@attbi.com> wrote in message news:20a401c3886c$eec74c70$a001280a@phx.gbl... > I have ...

Problems connecting after changing a username
I'm having an issue with a user account. On our Exchange server we have POP3 server running. I set up an user account and tested the settings for the POP3 account. Everything tested fine. I was informed by HR that there was a misspelling in the user's name, so I corrected it, but now when I try to connect to the POP3 server I get an error that says the username, password or e-mail address is incorrect. I can't help but feel this is related to the username change, but I'm not sure how to correct it. Can anyone help? -Michael Kun ...

Dexterity
Hello, I'm using GP 8.0 and I was experimenting with Dexterity to see if I could make a small change take effect when I ran Great Plains. I just modified one the Microsoft Business Solutions logo and put the word Test under the MBS text. When I look at any form tha uses that image I can see the change I made, however, when I run GP I cannot see the change I made. Can anyone tell me how to make the change stick completely? Thank you in advance. Hi If you have made changes to an existing Great Plains window and go through the process of creating a chunk file (see KB below) and create an ...

XSD.exe handling of mixed content types in generate classes?
I'm trying to generate class definitions from an XSD that contains something like: <xs:complexType name="foo" mixed="true"> <xs:choice minOccurs = "0" maxOccurs="unbounded"> <xs:element name = "bar" type = "something"/> ... <xs:element name = "baz" type = "somethingelse"/> </xs:choice> </xs:complexType> The C# code generated by XSD.exe creates a class that has an array of objects to allow for an arbitrary number of elements (reflecting the ...

Payee on check different than "my" payee name
Hi, A lot of companies are requesting that checks be payable to "a bunch of letters," that is not an acronym I will ever remember. The latest is *AAUM* for the University of Michigan Alumni Association, which I have as U of M Alumni Association." Since my payees that start with AA... are for Ann Arbor this doesn't work well for me. Assuming that I am wish to comply with their request, can I have a different "print on check as" like in QuickBooks; or can I use the nice "payee variation feature in money" in some creative way to achieve this effect. A hack...

configuring exchange to accept mail for a different domain
Hi Folks, Can i configure exchange 2003 to accept mail for a different domain as well as the domain in AD. I need to set it up to allow it accept mail for i.e info@test.com when my domain is testing.com. ANy ideas would be greatly appreciated In the management MMC: <SiteName>--->Recipients-->Recipient Policy-->Properties of Default Policy Select Email Addresses Tab Click "New" Choose "SMTP Address" Enter "@test.com" Leave the checkbox "checked" (Exchange ... is responsible for...) Click OK All Done. -- Phillip Windell [MC...

What is the difference between a blank cell and a (blank) cell in Pivot Table ?
I 'paste special' two columns A and B from sheet1 to columns C and D in sheet2 (i.e. col A --> col C and col B --> col D). Column A contains either a customer number (all are numeric digits) or nothing whereas Column B use a formula to determine whether it contains nothing or a customer name (all are alpha-numeric values). In Sheet 2, I use Pivot Table to generate a report containing columns C and D. For those cells in Col C whose corresponding source cells in Col A are blank, nothing is shown in these cells. However, for those cells in Col D whose corresponding source cells in...

Can I reverse the order of data in a set of cells?
I have a column of cells filed with data. I know I can transpose the data 90 degrees, but is there a way to cut or copy the data in the cells and paste it so the values are in the opposite order, i.e. a 180 degree difference? Thanks to anyone who can help. I am using Excel 2003. One way, insert a new column or use an existing, number it from 1 - n (where n is the last index value you want to reverse the order of, so if your column is 100 rows number the help column 1, 2, 3 - 100) select both columns and sort descending on the help column -- Regards, Peo Sjoblom "salwitt"...

Change Identity Name
I am using IE 6 SP1 and Outlook Express 6 to access newsgroups. I recently changed my last name so I changed it in Identities and the Local Users and Group (Win2000 Pro). However, it is still using my old name when I post to a newsgroup. What am I missing or where else do I have to change my name? Thanks. Hi, Rhea - This is a group to support Outlook from the Office group of programs. Outlook Express is a part of Internet Explorer and is a quite different program, despite its similar name.. You will probably get a faster and more expert answer if you post this to an Outlook Express new...

Save Times Changing Without Saving
I don't know if this is an excel thing or a LAN thing, but I've started noticing that my excel files are changing save time after I've had them open without me saving them. I know the time for an open file will list the time it was opened, but I'm talking about the open time staying with the file even after it is closed. I'm running excel 2002, XP Pro, and I think the server is Win 2000. (It's a large corporate WAN) Has anyone had this problem? If you still have the workbook open, then this is normal. But if you've closed the workbook without saving (and nothin...

Losing mail account POP3 and SMTP settings
Hi, I am using a new computer with XP and have recently set up Outlook on this machine. I set up my mail server information to have page.aiserv.net as my POP3 and my SMTP (as per instructions from my ISP). Each time I reboot the computer, the POP3 information is changed to 'localhost' and my incoming mail server account name is changed from the correct value to one which prepends 'localhost/'. I tried deleting the internet account information entry and starting from scratch, but the same thing happens. In addition to that, my password to login to the mail server is not rememb...

Same Header on Different Sheets
Is it possible to carry the same header and/or footers from one sheet to another within an Excel worksheet without having to re-type and format it for each sheet? Any guidance would be greatly appreciated. Thanks much, Tanya Hi one way: - make the sheet with this header/footer the first sheet in your file - select this sheet and the other sheets (while holding down the SHIFT key -> grouping the sheets) - goto 'File - Pagesetup' and simply press 'OK' Note: this copies ALL pagesetup settings to the other selected sheets In the same way you can set/change the header/foo...

THIS_FILE' : redefinition; different storage class while changing setting from /MD to /MDD
Hi, I working in finding out the memory leak in the application which was developed in vc++2005. I am using _CrtMemCheckpoint function to find out the memory leak these function will be working only when the application is in debug mode and the project setting should in /MDD or /MTD . When ever I change my setting from /MD to /MDD I get a compiler error Error 251 error C2370: 'THIS_FILE' : redefinition; different storage class i.e error is at #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE #pragma once static char THIS_FILE[] = __FILE__; #endif ...

Printing on PO Changes
We have frequent changes on open purchase orders. Occassionally when we send a change order to a vendor they will re-ship items on the PO that have already been shipped complete. Is it possible through report writer to prevent PO lines from printing if they have been fully received? We do not use SOP commitments on POs, so we have been able to key on the 'Qty Uncommitted in Base' within Smartlists to find the remaining open quantity on PO lines. Could this same key be used to affect printing? -- Jim@TurboChef ...

Class Names not available in Class Wizard
In Visual Studio 6.0 I have added a .cpp and .h file created in another MFC project to my current project They show up in the class view explorer and in the file window but when I am in Class Wizard the only class name available are the ones created in this project. Is there a way to add these so they will be available in Class Wizard? Delete the .clw file. Then try to use ClassWizard. It will rebuild the file with the names. joe On Fri, 5 Mar 2004 12:26:06 -0800, "Ward" <anonymous@discussions.microsoft.com> wrote: >In Visual Studio 6.0 I have added a .cpp and .h f...

Change order of text in a cell?
A1=John Smith, I was able to find on the internet how to reverse it to = Smith John. Question is if A1=John L Smith, then the formula changes it to L Smith John. Is there a formula to make John L Smith change to Smith John L? Is there a formula that can add the comma after the last name also? Appreciate any help you can give me. I'm tiring out looking for the answer on the internet, primarily because I having a hard time typing in a good keyword in google cause I'm not sure how to describe this problem (eg text manipulation, reversing order, switch text string, etc). Thank...

How to display a field from a different table in a list box?
Hello everyone! I'm trying to create this flow action without sucess: I've a form with a combo box (with a list of values) and a list box. What I want is to select a value from the combo and display in the listbox, one colunm of one specific table. This is possible to do? hi, Bluduckx wrote: > I've a form with a combo box (with a list of values) and a list box. > What I want is to select a value from the combo and display in the listbox, > one colunm of one specific table. > This is possible to do? Yes, take a look at the RowSource property of the ListBox. mfG...

How to change color of line and point markers on a line graph
Double click on point in chart to open Format dialog Open the Patterns tab and change colours as needed best wishes -- Bernard V Liengme www.stfx.ca/people/bliengme remove caps from email "SASPerson" <SASPerson@discussions.microsoft.com> wrote in message news:31B95F47-66D1-45BA-9456-A96758E21B6C@microsoft.com... > ...

Outlook form - Checkbox
Dear all, Let's assume I have 15 contacts. 5 of these contacts are clients and I would like to have a different background color of the contact form for these contacts that all employees know that these contacts are clients. The contacts are stored in the Public Folders. Any ideas how I could add a checkbox (add a custom tab) that if the checkbox is checked that the background color of this form would change (> all pages/tabs > General, Details, Activities, etc.)? Kind regards, Simon You can design your own custom contact form for this; Tools-> Forms-> ...