Re: Copying std::map with assignment
From: Leor Zolman (leor_at_bdsoft.com)
Date: 04/09/04
- Next message: Erik Jälevik: "Re: Copying std::map with assignment"
- Previous message: Erik Jälevik: "Re: Copying std::map with assignment"
- In reply to: Erik Jälevik: "Re: Copying std::map with assignment"
- Next in thread: Erik Jälevik: "Re: Copying std::map with assignment"
- Reply: Erik Jälevik: "Re: Copying std::map with assignment"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 09 Apr 2004 18:33:42 GMT
On Fri, 9 Apr 2004 19:13:13 +0100, "Erik Jälevik"
<erik.jalevikDELETE@ntlworld.THIScom> wrote:
>"Leor Zolman" <leor@bdsoft.com> wrote in message
>news:2v7b705nnbojhba1jbg8e5s0c2t1kn8879@4ax.com...
>>
>> Consider yourself lucky; the compiler could have chosen to generate code
>to
>> erase your hard disk (in response to your invocation of undefined
>behavior)
>> and still have been conformant ;-)
>
>Yes, if I'd been really unlucky. ;)
>
>I don't think MSVC would do this though. Normally if I try to access a
>vector out of bounds, it fires up an Access Violation error straight away if
>the location is outside of the application's memory space. But in this case,
>the memory just after the vector seemed to have been allocated to the map,
>hence no memory error until that map was deleted or copied.
That's what UB is all about. The "luckiest" you can be is to get an
immediately access violation, for the reasons you've outlined. But
off-by-one types of errors will often (usually?) not be as considerate as
to announce themselves so plainly...
-leor
>
>Erik
>
-- Leor Zolman --- BD Software --- www.bdsoft.com On-Site Training in C/C++, Java, Perl and Unix C++ users: Download BD Software's free STL Error Message Decryptor at: www.bdsoft.com/tools/stlfilt.html
- Next message: Erik Jälevik: "Re: Copying std::map with assignment"
- Previous message: Erik Jälevik: "Re: Copying std::map with assignment"
- In reply to: Erik Jälevik: "Re: Copying std::map with assignment"
- Next in thread: Erik Jälevik: "Re: Copying std::map with assignment"
- Reply: Erik Jälevik: "Re: Copying std::map with assignment"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|