This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch/rfc] Eliminate char buf[MAX_REGISTER_RAW_SIZE]


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]