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: Correct fix for stdbool?


Andrew Cagney <ac131313@cygnus.com> writes:

> So what is the correct fix for the <stdbool.h> true/false problem?
> 
> Off the top of my head, I can think of:
> 
> - delete boolean / true / false replacing them with int.
> The ``come'on, admit it, this is C'', line of reasoning.
> 
> - change verything to
> typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean;
> The ``well it can't be worse than it is now'', line of reasoning.
> 
> - add a "bfd_stdbool.h"
> Which is included explicitly and defines "true" and "false". "bfd.h"
> doesn't depend on it.
> The ``lets pretend'', line of reasoning.

I think we should remove the identifiers boolean, true, and false from
bfd.h.  Within bfd.h, we should replace boolean with bfd_boolean.  I
think bfd_boolean should be typedef to int.  We can define bfd_true
and bfd_false if we want to, but it really doesn't matter.

Code which uses bfd.h will then have to change.  The simple change for
the binutils is to define boolean, true and false in an internal
header file.  That header file can include <stdbool.h> if it exists,
and define boolean in terms of bool.

gdb will also have to change, as it uses true and false in a few
places.  This change to bfd.h may also break any other existing users.

Ian


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