https://codereview.chromium.org/411263004/diff/1/src/rempio2.h
File src/rempio2.h (right):

https://codereview.chromium.org/411263004/diff/1/src/rempio2.h#newcode27
src/rempio2.h:27: static void* constants() { return
const_cast<double*>(constants_); }
On 2014/07/24 10:44:21, Sven Panne wrote:
Casting away const here looks wrong: The array itself is in read-only
memory,
and any write access will lead to a segfault. If the caller needs a
non-const
pointer, the const_cast should be there (still dangerous) or it should
copy the
contents into RW memory. In our case: After const_casting in
bootstrapper.cc,
writing into kTrig on the JavaScript side leads to a segfault, which
is
semi-nice, but it's OK if there is a warning comment.

Now that the const_cast in TrigonometricConstants has been removed,
there is not
much need for a real class anymore:

    struct TrigonometricConstants {
      static const double constants[34];
    };

is enough, the size can be calculated via ARRAY_SIZE. I want C++11's
uniform
initialization and std::array... :-/

Done.

https://codereview.chromium.org/411263004/

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to