Exception "Access Violation" in debug VC++ ver 6 
Author Message
 Exception "Access Violation" in debug VC++ ver 6

I developed my Windows-based application under MS VC++ ver 4 and 5. This
application modifies temporarily literal string (like: char * p; char c; p = "Any
String"; c = *p; *p = '\0'; ... *p = c;).
Recently I moved the project under VC++ ver 6 (SP 5) and when running debug
version of my application the de{*filter*} reports "Unhandled exception 0xC0000005:
Access Violation" at the statement which modifies string (i.e. *p = '\0';). Looks
like de{*filter*} ver 6 assigns read-only attributes to memory segments storing
constant strings. The problem does not appear in the release version generated by
VC++ ver 6.
Does anybody know how to turn off this feature ? (build option, API called at run-
time like _CrtSetDbgFlag etc).

Thanks in advance for any help
Jack Napiatek



Wed, 15 Oct 2003 07:30:55 GMT  
 Exception "Access Violation" in debug VC++ ver 6
VC6 defaults to /ZI which makes constant strings read-only (in debug
builds). Changing to /Zi (ie turning off Edit & Cont) will work around it.
You should really fix your code though.


I developed my Windows-based application under MS VC++ ver 4 and 5. This
application modifies temporarily literal string (like: char * p; char c; p =
"Any
String"; c = *p; *p = '\0'; ... *p = c;).
Recently I moved the project under VC++ ver 6 (SP 5) and when running debug
version of my application the de{*filter*} reports "Unhandled exception
0xC0000005:
Access Violation" at the statement which modifies string (i.e. *p = '\0';).
Looks
like de{*filter*} ver 6 assigns read-only attributes to memory segments storing
constant strings. The problem does not appear in the release version
generated by
VC++ ver 6.
Does anybody know how to turn off this feature ? (build option, API called
at run-
time like _CrtSetDbgFlag etc).

Thanks in advance for any help
Jack Napiatek



Wed, 15 Oct 2003 07:51:41 GMT  
 Exception "Access Violation" in debug VC++ ver 6
Yes. You should revise your code first.

yhhuang
ICQ:91074870



Fri, 17 Oct 2003 16:49:36 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. "Access violation" accessing a DLL

2. "Access Violation" with Release version

3. CString strange "Access Violation" error

4. VC "unrecognized database" Access 2000

5. ODBC Error - "Restricted data type attribute violation", code 07006

6. StartDocPrinter "Sharing Violation Problem"

7. Question About "First-chance exception in psMng.exe (PCPR.DLL): 0xC0000005: Access Violation"

8. DoModal generates "First Chance Exception: Access Violation"?

9. Dialog generates "first chance exception: Access violation"?

10. "Exceptions" in C

11. "Exception from HRESULT: 0x80040202."

12. "Exceptions" in C

 

 
Powered by phpBB® Forum Software