[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: invalid type conversion when using C++ API
From: |
mmuetzel |
Subject: |
Re: invalid type conversion when using C++ API |
Date: |
Wed, 30 May 2018 00:35:22 -0700 (MST) |
> The compiler shows that:
> Severity Code Description Project File Line Suppression State
> Error C2440 'static_cast': cannot convert from 'octave_idx_type *' to
> 'long
> *' TestOctaveStandAlone
> c:\octave\octave-4.4.0\include\octave-4.4.0\octave\dim-vector.h 156
>
> The problem is located in oct-refcount.h, for the functions:
> OCTAVE_ATOMIC_INCREMENT, OCTAVE_ATOMIC_DECREMENT,
> OCTAVE_ATOMIC_POST_INCREMENT, OCTAVE_ATOMIC_POST_DECREMENT, in which a
> variable x is converted from octave_idx_type* to long*.
That a static_cast from 'octave_idx_type *' to 'long *' works on some
systems and not on others is probably because "long" is of different size
dependent on host and architecture.
> How can I resolve the problem?
Maybe it would work using a reinterpret_cast instead...
--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html