This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

Re: c++/1488: No C++ warning option to guard against bogus returntypes for C linkage


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


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