This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] alloca coding standard
- To: nsd at redhat dot com
- Subject: Re: [RFA] alloca coding standard
- From: Eli Zaretskii <eliz at delorie dot com>
- Date: Mon, 13 Nov 2000 06:16:04 -0500 (EST)
- CC: gdb at sources dot redhat dot com
- References: <3A0CE1DB.6F6B1E93@cygnus.com> <200011130654.eAD6sjV16467@rtl.cygnus.com>
- Reply-to: Eli Zaretskii <eliz at is dot elta dot co dot il>
> 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.