[ODE] Re: ALLOCA

Olivier Michel Olivier.Michel at cyberbotics.com
Thu Feb 26 15:27:31 MST 2004


Hi,

This is really beautiful. However, I wonder if the ## define stuff is 
compatible with all gcc, Visual C++ and other compilers we use.
Shall I modify my patch to use this new facility before someone commit 
it to the CVS ?

-Olivier

Jon Watte wrote:

>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
>
>
>
>_______________________________________________
>ODE mailing list
>ODE at q12.org
>http://q12.org/mailman/listinfo/ode
>
>  
>


More information about the ODE mailing list