[LLVMdev] Imprecise description of malloc instruction
Chris Lattner
sabre at nondot.org
Sat Feb 9 10:14:25 PST 2008
On Feb 7, 2008, at 9:51 AM, Gabor Greif wrote:
> Hi all,
>
> Quoting <http://llvm.org/docs/LangRef.html#i_malloc>:
>
> The 'malloc' instruction allocates sizeof(<type>)*NumElements bytes
> of
> memory from the operating system and returns a pointer of the
> appropriate type
> to the program. If "NumElements" is specified, it is the number of
> elements allocated.
>
>
> Obviously this does not say that the default for NumElements is one.
> Even obvious assumptions should be *explicit* in a spec :-)
>
> May I reword as:
>
> The 'malloc' instruction allocates sizeof(<type>)*NumElements bytes
> of
> memory from the operating system and returns a pointer of the
> appropriate type
> to the program. If "NumElements" is specified, it is the number of
> elements allocated,
> otherwise "NumElements" is defaulted to be one.
Looks great, please do Gabor. The description for alloca also needs
update probably.
Thanks!
-Chris
More information about the llvm-dev
mailing list