[openib-general] Re: [PATCH 09/12] SRP: Changing ibsrpdm

Jason Gunthorpe jgunthorpe at obsidianresearch.com
Tue May 2 09:48:41 PDT 2006


On Tue, May 02, 2006 at 09:42:18AM -0700, Roland Dreier wrote:
>     Ishai> alloca man page on my system says: The alloca() function is
>     Ishai> machine and compiler dependent.  On many systems its
>     Ishai> implementation is buggy. Its use is discouraged.  Lets not
>     Ishai> use it.
 
> The man page is talking about non-Linux systems I think.  I don't know
> of any problems with any modern Linux libc so I think it's better to
> have something automatically leak proof.

As a note the standards compliant way to get 'alloca' is via C99
runtime sized arrays, ie:

void foo(int len)
{
    char bar[len];
}

GCC has supported this feature from C99 for a very long time as long
as it isn't turned off by a compiler flag. alloca was never
standardized by ISO or POSIX.

-- 
Jason Gunthorpe <jgunthorpe at obsidianresearch.com>        (780)4406067x832
Chief Technology Officer, Obsidian Research Corp         Edmonton, Canada



More information about the general mailing list