0xc0000005 error

This is a discussion on 0xc0000005 error within the C++ Programming forums, part of the General Programming Boards category; Bleh!!!! more potential problems come out. Originally Posted by Hankyaku Since I use C++Builder 5.0 I use AnsiString types. AnsiStrings ...

  1. #31
    Registered User
    Join Date
    Jun 2005
    Posts
    6,531
    Bleh!!!! more potential problems come out.
    Quote Originally Posted by Hankyaku View Post
    Since I use C++Builder 5.0 I use AnsiString types.
    AnsiStrings are somewhat different from a standard C++ string. Not least of which is that an AnsiString is actually a hybrid type from Delphi, with attributes such as indexing starting at 1 (mismatched indexing is a common source of errors with arrays). AnsiString's use a COW (copy on write) technique for lazy copy, which is not necessarily thread safe, so considerable care is needed to use them correctly in multi-threaded code.

    However, while AnsiStrings can be misused, I would not necessarily assume your real problem is with AnsiStrings.
    Quote Originally Posted by Hankyaku View Post
    And the real thing I'm wondering on is that since now, I never had any problems with the code I wrote, I mean the exceptions or overflows. Whenever a problem arouse, the compiler always told me that there's a problem, or during debug they appeared. A clear nice crash, at a definite place. But now? These programs are less complex than those I wrote earlier. Still, it's a mess now. One of them actually is just refreshing an older code, and making some additions. I'm having a similar problem at that one. (That's why I was thinking that a new installed component could've caused the trouble.)
    If what you say here is true then, quite frankly, if you've never had problems in code you wrote before, that was good luck rather than good planning. Or, more likely, the problems existed in your original code, but you were simply oblivious.

    The main point of advice in this thread is to program defensively to avoid errors, rather than trying to find the cause of errors after the fact.

    Essentially, you are doing exactly the opposite: mashing together sections of code that (you think) worked separately, assuming they will work together, and then struggling to find the causes of errors that occur because you have mashed them together.
    Last edited by grumpy; 03-11-2008 at 12:12 PM.

  2. #32
    Registered User
    Join Date
    Mar 2003
    Posts
    105
    My code is a simple single threaded app, nothing fancy.

    If what you say is the fact, then I really am a lucky person. I'm not oblivious, I'm just simply unaware of obliviousnesses of the compiler. Whenever I had any problems with the AnsiStrings, they were wrong indexing (0), or out of bound, but I always got an exception. Whenever I made similar errors to arrays, I always got an exception.

    I'm running through my code (the parts, where I operate with arrays, complete debugging of course always checking the indexing variables), but the only way of such out of bound errors is the overaddressing, which does not occur, as there aren't simply enough data to fill my arrays with (I am testing only).

    So I began rewriting the code (as you mentioned "mashing" - to be honest, I'd prefer rebuilding, as that involves not only Ctrl+C, Ctrl+V), caring of course again for the indexing, but still, nothing came into view. More to that. The code is nearly complete (nearly the same as it was), and there are no errors like this, at all. What's yet to be done are only some formal things, no arrays, only visual components (backgnd colors, captions, sort of).
    So hopefully tomorrow I'll be done with it. I'll be back with the news, may anything arouse.

    There's another code which I have this problem with, I'll have to be done with that too, afterwards, but I'd check that one rather than rebuilding it. I'll be back, if I run into anything.

    Meanwhile, you could write me how to program defensively. I'm really curious about what it means in this point of view. (To me it only means to keep the amount of data and variables in hand - I write only simple applications. I'm curious if I can do anything extra for checking.)

  3. #33
    Registered User
    Join Date
    Mar 2003
    Posts
    105

    Problem solved

    Well, indeed my first guess was right.
    My vcl50.bpl was somehow screwed. I got a different version to my exes, and they all work fine. The error was within that package, however I don't know how it got there.

    Maybe there's a little chance that I'm programming defensively enough (and that BCB is still a good IDE).

Page 3 of 3 FirstFirst 123
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 09:18 PM
  2. An error is driving me nuts!
    By ulillillia in forum C Programming
    Replies: 5
    Last Post: 04-04-2009, 10:15 PM
  3. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 02:17 PM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 01:10 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21