This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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: [RFA] Replace strdup with xstrdup in tic30-dis.c


On Thu, Nov 28, 2002 at 06:23:42PM -0500, Andrew Cagney wrote:
> >OK, OK.  :)  "typedef int bfd_boolean" it is.  Plain 0 and 1 for values.
> 
> You ment 0 and !0 right? :-^

Actually, having started to do the edit, I'm having second thoughts
about using plain old 0 and 1.  I think I'll use FALSE and TRUE, and
#undef and #define these macros in bfd-in.h.  Besides being consistent
with a "boolean" type, it means less formatting changes.  Anyone
have any objections?


A whinge.  This style of function declaration is a pain:

boolean function_with_a_long_name_or_lots_of_params PARAMS ((type1 arg1,
                                                             type2 arg2,
                                                             typen argn));

This is much better:

boolean function_with_a_long_name_or_lots_of_params
  PARAMS ((type1 arg1, type2 arg2, typen argn));

The first style means more editing when changing the return type or
function name as all the following lines need re-indenting.

Same goes for definitions.  This is a pain:

int some_func (a, b, c)
     boolean                a;
     all_lined_up_sweetly * b;
     int                    c;

Writing code this way almost guarantees that over time your code will
end up looking like:

int some_func (a, b, c)
     bfd_boolean                a;
     not_lined_up * b;
     int                    c;

Ditto local vars.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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