|
From: | Paul Kienzle |
Subject: | Re: Pointers data type in Octave to handle data structures |
Date: | Thu, 23 Jun 2005 08:18:34 -0400 |
On Jun 23, 2005, at 3:16 AM, Stefan van der Walt wrote:
On Wed, Jun 22, 2005 at 08:51:25PM -0400, Paul Kienzle wrote:Guillaume,The lazy way is to simply return an int big enough to hold the pointer:if (sizeof(octave_int32_t) >= sizeof(void*)) return octave_value(static_cast<octave_int32_t>(ptr)) else return octave_value(static_cast<octave_int64_t>(ptr))I ask this in complete ignorance, but how does one guarantee that the pointer data (ptr*) isn't re-allocated or overwritten by another part of Octave or some other dynamic function?
A new pointer will be good until you delete it, or in C, a malloc'd pointer will be good until you free it. - Paul
[Prev in Thread] | Current Thread | [Next in Thread] |