This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [patch/rfc] Eliminate char buf[MAX_REGISTER_RAW_SIZE]
- From: Joel Brobecker <brobecker at gnat dot com>
- To: Andrew Cagney <ac131313 at redhat dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Sat, 1 Feb 2003 10:13:10 +0400
- Subject: Re: [patch/rfc] Eliminate char buf[MAX_REGISTER_RAW_SIZE]
- References: <3E3AFFA5.9080902@redhat.com>
> Since MAX_REGISTER_RAW_SIZE is implemented using a function the declaration:
>
> char buf[MAX_REGISTER_RAW_SIZE];
>
> is illegal. (GCC does allow it which is why no one notices :-/).
>
> The attached patch updates all obvious (as in found by a grep)
> occurances of this and changes them to:
>
> char *buf = alloca (max_register_raw_size (current_gdbarch));
I have a simple (stupid?) question: Generaly speaking, is there a
prefered form between the following two?
max_register_raw_size (current_gdbarch)
or
MAX_REGISTER_RAW_SIZE
These two forms are exactly equivalent, but in most occurences I've seen
in the code, we used the macro... But maybe you used the non-macro form
to show that we do an alloca because the size of the buffer is not known
at compile-time?
--
Joel