This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, fortran, 4.9] Use bool type instead gfc_try
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: "N.M. Maclaren" <nmm1 at cam dot ac dot uk>
- Cc: Fortran List <fortran at gcc dot gnu dot org>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 21 Mar 2013 23:42:27 +0000
- Subject: Re: [Patch, fortran, 4.9] Use bool type instead gfc_try
- References: <CAO9iq9F0rhbqe-LMB1d=0pNyKraPK_KVKc2Tg1j2EP8Zu+EUgA at mail dot gmail dot com> <5148A0A0 dot 8010209 at net-b dot de> <Prayer dot 1 dot 3 dot 5 dot 1303212205310 dot 2429 at hermes-1 dot csi dot cam dot ac dot uk>
On Thu, 21 Mar 2013, N.M. Maclaren wrote:
> On Mar 19 2013, Tobias Burnus wrote:
> > Am 19.03.2013 13:15, schrieb Janne Blomqvist:
> >
> > > now that the Fortran frontend is C++ we can use the primitive bool
> > > type instead of inventing our own.
> >
> > Well, C99's "bool" (_Bool) was already used before. ...
>
> Er, that is making a serious mistake or, at least, running the risk of
> one. C++'s bool and C99's _Bool are NOT compatible types. The UK tried
> to get _Bool either made compatible with C++ or (preferably) dropped, but
> failed in both.
They have been ABI-compatible in GCC ever since I implemented C99 _Bool
(as opposed to the different, incompatible version in earlier C9X drafts)
in <http://gcc.gnu.org/ml/gcc-patches/2000-10/msg01127.html>, and the
semantics are essentially the same except that C++ disallows decrement
operators (prefix and postfix --) on bool and C allows them. (I don't
know what C++ specifies regarding bool bit-fields or whether there are any
incompatibilities there, but for non-bit-field objects you shouldn't have
problems.)
--
Joseph S. Myers
joseph@codesourcery.com