RE: [boost] spirit 1.8 / vc 8.0 test results

Paul A Bristow <pbristow@hetp.u-net.com> wrote: <snip>
PS The query was about an item which failed to compile using 8.0 (OK with 7.1)
template<typename T, typename BigT> out_sqr(ostream& os, T x, BigT temp) { temp = x * x; os << temp; }
Bray says that this is because the implicit function return type is int,
This is a non-standard extension for compatibility with a predecessor of C that was replaced over 30 years ago. It appals me that any current C++ compiler still supports it.
I assumed that the implicit function return type was void, and indeed if void is added, it works as expected.
C++ does not allow the return type to be implicit, and when it was allowed in C (prior to the 1999 standard) it was int.
Can anyone who has digested the Standard quote chapter and verse on this?
You're kidding, right?

| -----Original Message----- | From: boost-bounces@lists.boost.org | [mailto:boost-bounces@lists.boost.org] On Behalf Of Ben Hutchings | Sent: 16 September 2004 15:11 | To: boost@lists.boost.org | Subject: RE: [boost] spirit 1.8 / vc 8.0 test results | | Paul A Bristow <pbristow@hetp.u-net.com> wrote: | <snip> | > PS The query was about an item which failed to compile using 8.0 | > (OK with 7.1) | > | > template<typename T, typename BigT> | > out_sqr(ostream& os, T x, BigT temp) | > { | > temp = x * x; | > os << temp; | > } | > | > Bray says that this is because the implicit function return type is | > int, | | This is a non-standard extension for compatibility with a predecessor | of C that was replaced over 30 years ago. It appals me that any | current C++ compiler still supports it. Well MSVC 7.1 did! And didn't even squeak at warning level 4 when no return statement was provided! But things are improving - including my knowledge of C++ ;-) Paul Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB +44 1539 561830 +44 7714 330204 mailto: pbristow@hetp.u-net.com
participants (2)
-
Ben Hutchings
-
Paul A Bristow