jacob said:
This function is not mentioned very often in this newsgroup but it
is a VERY useful function, implemented in most compilers.
[Referring to "alloca" in the subject, but not the body.]
I think it is useful to point to it since many people that read this
newsgroup are newcomers, and they could benefit by using it. [...]
Some people in this newsgroup will raise hell because it is a function
not mentioned in the standard. Since this is not comp.std.c I really do
not care, and I think that new users should be aware of its existence,
and the possible advantages and problems with its usage.
Well, I find open(), select(), and socket() quite useful as well, and
they're available on every platform I use, but that doesn't make them
relevent to clc.
And, to your mention as to how wide-spread it's availablility is, here
is what happens on my Windows system, with MSVC:
==========
C:\temp>type usenet.c
#include <stdio.h>
#include <stdlib.h>
int main()
{
char *foo = alloca(100);
}
C:\temp>cl usenet.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
usenet.c
usenet.c(6) : warning C4047: 'initializing' : 'char *' differs in levels of indi
rection from 'int '
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:usenet.exe
usenet.obj
usenet.obj : error LNK2001: unresolved external symbol _alloca
usenet.exe : fatal error LNK1120: 1 unresolved externals
C:\temp>
==========