ALLOCA (was: RE: [ODE] ODE on Linux IA-64?)

Jon Watte hplus-ode at mindcontrol.org
Wed Feb 25 11:58:17 MST 2004


Regarding ALLOCA, you might not need a FREEA() macro, if you structure the
macro something like so:

class StackMemory {
public:
  StackMemory( int size ) {
    ptr_ = malloc( size );
  }
  ~StackMemory() {
    free( ptr_ );
  }
  void * ptr_;
};

#define ALLOCA(v,s) \
  StackMemory alloca_ ## __LINE__( s ); v = alloca_ ## __LINE__ .ptr_


Note that this macro needs to take the assigned-to variable as well as the
size, rather than just the size.

Cheers,

			/ h+



-----Original Message-----
From: ode-bounces at q12.org [mailto:ode-bounces at q12.org]On Behalf Of Artur
Matos
Sent: Wednesday, February 25, 2004 3:03 AM
To: ode at q12.org
Subject: Re: [ODE] ODE on Linux IA-64?


On Tue, 24 Feb 2004 14:48:36 +0100
Michael Lacher <michael.lacher at hlw.co.at> wrote:

> I guess this is due to the fact that pointers on 64bit architectures are
> 64 bit wide ? This means that all cases were pointers are cast to 32bit
> integers (for user data in callbacks, etc ...) need to be checked (as is
> done in the dALLOCA16 macro.

Yes, I also guess that should be the problem. Unfortunately, I am not
knowledgeable about ODE internals, so I would prefer not to change the code
without some guidance. Also, currently the ALLOCA macros are being
refactored, so maybe this will not be an issue in the next release. Maybe I
should try to contact the programmer working on them?

Artur Matos.
_______________________________________________
ODE mailing list
ODE at q12.org
http://q12.org/mailman/listinfo/ode





More information about the ODE mailing list