Click to See Complete Forum and Search --> : Problem with 'new' operator


SPatten
November 24th, 2003, 09:24 AM
I have an application in VC6 compiling and running fine.
I am trying to port it to VC7 but it is crashing when compiled with VC7. This happens inside the new operator.
To try and isolate the problem we took our 'offending' class and created a scaled-down test app which uses this class in the same way but does nothing else.

This compiles and runs fine under both vc6 & vc7. What I have noticed however when stepping through the code, is that our original app uses a different 'new' operator from the test app.
The original uses 'newop.cpp' and the test app uses 'new.cpp'; in vc6 both apps use 'new.cpp'

Why are there 2 new operators?
How does the compiler decide which one to use?
Could this be the cause of my problem (it doesn't crash on every single use of the new operator)?

Thanks
Stef

pradeepks_61
November 25th, 2003, 12:33 AM
This problem is becuse ure project settings is set to use compiler optimisation options. Goto project settings.... c++ tab. match the "project options " in vc6 and vc7. This decides what operator is to be used in the compilation process... i had this problem... if possible read up a book called compiler design a chapter which talks about optimisation.... that will help u understand

vicodin451
November 25th, 2003, 07:09 AM
Originally posted by pradeepks_61
This problem is becuse ure project settings is set to use compiler optimisation options. Goto project settings.... c++ tab. match the "project options " in vc6 and vc7. This decides what operator is to be used in the compilation process... i had this problem... if possible read up a book called compiler design a chapter which talks about optimisation.... that will help u understand

What? Can you specify the exact setting in VC++ 6 and VC++ 7 that will cause this behavior?

I am interested in this post, and would like to see and step thru the code SPatten used to show this behavior. I would also like to know what SPatten means by "crash".