Erik Wikstrm wrote:
> On 4 Juni, 23:14, Gianni Mariani <gi3nos
@mariani.ws> wrote:
>> desktop wrote:
>>> Why does the value of the below int pointer not disappear after using
>>> destroy:
>>> std::allocator<int> allo;
>>> int* ip;
>>> allo.construct(ip,777);
>>> std::cout << "*ip = " << *ip << std::endl;
>>> allo.destroy(ip);
>>> std::cout << "*ip = " << *ip << std::endl;
>>> I get two prints with 777.
>> What do you think "destroy" does ? What do you expect it to do ?
>> It's undefined in this case. It might print 777 on your platform, it
>> might not on mine and it might melt the cpu on other platforms.
> Did I read you post wrong?
The second sentence refers to the code in the post - in particular the > ... Because to me it seems like the call to
> destroy is quite defined while the last line (where the pointer is
> dereferenced) is undefined.
Yeah - it may be stated in an ambiguous way.