Re: Copying std::map with assignment

From: Leor Zolman (leor_at_bdsoft.com)
Date: 04/09/04


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


Relevant Pages

  • Re: Still confused why working set larger than virtual memory
    ... With the SysInternals Process Explorer the column is called Working Set. ... What you removed is exactly the "smart trick" to have memory "accessible", ... as you map views you never unmap. ... I attach my test source which I used for my file mapping measurements. ...
    (microsoft.public.vc.language)
  • [PATCH] x86: make e820.c to have common functions
    ... * replaces the original e820 map with a new one, ... * will have given us a memory map that we can use to properly ... struct e820entry map; ... extern void setup_memory_map; ...
    (Linux-Kernel)
  • Re: Help me pick which is best
    ... That's why the expandable memory seemed so attractive but then the battery is rechargeable, which I guess may not be a huge problem, but who knows. ... If you wanted to change from street and highway mapping to topo mapping on the fly, you might need to have access to a computer to upload the new mapping. ... In use I would have to change from one regional map to the next as I traveled, it takes about 15 regional map files to cover the entire U.S. with DirectRoute or Topo 3D. ... The process of making the regional map files is a little bit technical or arcane because, while Magellan says that map files can only be 16mb, there many, many, Meridian users that are making and using 64mb map files. ...
    (sci.geo.satellite-nav)
  • Re: error wince600 boot message after dowload PB6 OS to HW board
    ... I would suspect that you have a memory layout problem, either the bootloader is using memory that is clobbering the downloaded image in some way, or the memory layout in the config.bib is wrong. ... Old or invalid version stamp in kernel structures - starting clean! ... Exception 'Access Violation': Thread-Id=00410002, ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Memory Map Accelent Board
    ... CS1 - Alternate Flash ... > I derived in a great difficulty the following memory map for Accelent. ...
    (microsoft.public.windowsce.embedded)

Loading