Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 6th, 2005, 05:19 AM
Registered User
Join Date: Jan 2005
Location: , , .
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??


Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 10:20 PM.

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