Boost logo

Boost :

From: Ben Hutchings (ben.hutchings_at_[hidden])
Date: 2004-09-16 09:11:06


Paul A Bristow <pbristow_at_[hidden]> 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?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk