Wrox Programmer Forums
|
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 6th, 2005, 05:19 AM
Registered User
 
Join Date: Jan 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default weird access violation

hi everyone,
in wrote a program in visual c++ 6.0, and got an access violation exception after writing to a recently allocatd struct.
something like:

p=new struct_c // didn't get NULL here
p->something=value // here i got an access violation

now, i checked the code and found that before these lines i wrote to some address that was not allocated yet. when i fixed this bug, the access violation was gone.

to conclude:
1. i wrote an address that wasn't allocated and got no no error
2. i succeeded to allocated memory for my struct
3. when i wrote to the field of the struct i got the error.

i can't figure out how did the new command gave me an address and yet later i got access violation for using it.

my best guess is that visual c has it's own registration of used memory and the new command uses a different mechanism (??)

anyone has a clue??

Yosi






Similar Threads
Thread Thread Starter Forum Replies Last Post
Access violation continues after catch (...) block Avihay Visual C++ 1 June 9th, 2006 02:03 AM
PHP has encountered an Access Violation at 0B63E30 p2ptolu PHP Databases 0 June 2nd, 2006 07:31 AM
Weird error when inserting into Access!!! tryston02 ASP.NET 1.0 and 1.1 Basics 1 April 6th, 2005 07:30 AM
Weird Access Problem MattyJ Access 2 October 1st, 2004 02:10 PM
Access Violation ? T-5 Beginning PHP 1 July 24th, 2004 09:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.