[RFA] alloca coding standard
Eli Zaretskii
eliz@delorie.com
Mon Nov 13 03:16:00 GMT 2000
> Date: Mon, 13 Nov 2000 01:54:45 -0500
> From: Nick Duffek <nsd@redhat.com>
>
> diff -up gdb/doc/gdbint.texinfo gdb/doc/gdbint.texinfo
> --- gdb/doc/gdbint.texinfo Mon Nov 13 01:25:51 2000
> +++ gdb/doc/gdbint.texinfo Mon Nov 13 01:25:15 2000
> @@ -2854,6 +2854,24 @@ visible to random source files.
I have a few minor comments (assuming that the idea is accepted and
this text will be added to gdbint.texinfo):
> +@subsection Alloca
I suggest an index entry here, e.g. "@findex alloca usage". (Hmm, it
looks like gdbint.texinfo doesn't print an index right now. I will fix
that.)
> +@code{alloca} may be used for allocating up to a page of stack memory
> +per function call.
I'd suggest to say how much is a "page", at least for a couple of
popular architectures. Not everyone is privy to intimate details of
system's memory allocation.
> +garbage-collect freed space. As of this writing, @value{GDBN} calls
> +@code{alloc (0)} once per user command and once per inferior wait.
^^^^^
This should be `alloca', not `alloc'.
Finally, perhaps something should be said about functions that could
potentially be called recursively, where care should be taken not to
overflow the runtime stack, even if each invocation asks a single
page.
More information about the Gdb
mailing list