Boost logo

Boost Users :

From: Thomas Maeder (yg-boost-users_at_[hidden])
Date: 2003-03-01 06:34:14


jhr.walter_at_[hidden] writes:

> But I needed to use
>
> double *rdata = new double (n);

This dynamically creates one double object and initializes it with the value
n and uses its address to intialize rdata.

> ...
> delete [] rdata;

And this tells the compiler to deallocate the dynamically allocated array
rdata points to. Your program has undefined behavior.

I haven't followed this thread, but the code you posted here definitely looks
very fishy.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net