[En-Nut-Discussion] Use of alloca in Nut/OS

Harald Kipp harald.kipp at egnite.de
Mon Aug 11 11:03:50 CEST 2008


Henrik,
Ole,

Henrik Maier wrote:
> I suggest to leave it to the system designer (the person who configures
> Nut/OS for a particular platform) to decide which way to go. That means an
> entry in the Configurator rather using magic pre-processor definitions.
> There are also ARM based systems out there with only 32K of RAM where the
> thread stack space may only be 512 bytes.

I agree here. We should move away from preprocessor macros based on CPU 
type/family or compiler/runtime version towards specific attribute 
macros, e.g. NUT_USE_ALLOCA.

In certain situations defaults may be provided based on the platform or 
the toolchain in use. In general, however, the code should be based on 
the least common denominator. In our special case, the libraries should 
be compilable without runtime routines like strtok_r or alloca, which 
are not used elsewhere in the code base. This has two advantages: 
Porting code to new compilers and targets becomes easier and in case of 
problems with advanced runtime library implementations we are able to 
switch back to the simple, possibly less efficient code.

Harald





More information about the En-Nut-Discussion mailing list