This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/1488: No C++ warning option to guard against bogus returntypes for C linkage
- To: nobody at gcc dot gnu dot org
- Subject: Re: c++/1488: No C++ warning option to guard against bogus returntypes for C linkage
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Date: 21 Dec 2000 14:36:00 -0000
- Cc: gcc-prs at gcc dot gnu dot org,
- Reply-To: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
The following reply was made to PR c++/1488; it has been noted by GNATS.
From: "Joseph S. Myers" <jsm28@cam.ac.uk>
To: <jon.connell@arm.com>
Cc: <gcc-gnats@gcc.gnu.org>, <michael.williams@arm.com>,
<richard.earnshaw@arm.com>, <gcc-bugs@gcc.gnu.org>
Subject: Re: c++/1488: No C++ warning option to guard against bogus return
types for C linkage
Date: Thu, 21 Dec 2000 14:28:24 +0000 (GMT)
On 21 Dec 2000 jon.connell@arm.com wrote:
> When returning or passing parameters to/from a C++ function
> that is declared to have C linkage, non-C datatypes should
> be flagged with a warning to avoid errors.
> >How-To-Repeat:
> Pass the attached script to bash.
>
> Whilst the programmer could have easily chosen a typedef
> for bool in C which matched the C++ implementation on the
> host system, the choice of bool for a return type of a
> C++ function with C linkage was probably an error and ought
> to raise a warning.
In the case of bool, this is no longer a problem with CVS GCC and the
current C standard: ISO C now includes the boolean type _Bool, which is
compatible with that used for C++ (at least for the new ABI); if you
include <stdbool.h> with CVS GCC (for the bool typedef) instead of
defining your own typedef, you get the expected results.
--
Joseph S. Myers
jsm28@cam.ac.uk