This is the mail archive of the
gcc-bugs@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: <jon dot connell at arm dot com>
- 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: Thu, 21 Dec 2000 14:28:24 +0000 (GMT)
- cc: <gcc-gnats at gcc dot gnu dot org>, <michael dot williams at arm dot com>, <richard dot earnshaw at arm dot com>, <gcc-bugs at gcc dot gnu dot org>
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