Date: 2001-11-13 09:45:26
From: Peter Dimov [mailto:pdimov_at_[hidden]]
> From: "David Abrahams" <david.abrahams_at_[hidden]>
> [about f(g()) where g() returns void]
> > Should we really cripple bind() just because the core language is
> Is it? f() takes zero arguments. The expression list 'g()'
> contains one
> expression. They are incompatible.
The problem is that with:
'void' is not a type of a parameter -- it only indicates the absense of any
parameters. Looking at it that way, f(g()) should not work, since it
implies g() is supplying a parameter of type 'void' to f.
But looking at it the other way:
'void' *is* a type -- the type of the result of g. In this case, it does
mean "no result", but with void returns etc. entering the language, it makes
'void' into an actual type. 'void' is also a type in other contexts, e.g.,
as a template type parameter, or 'typedef void ...' So looking at it this
way, f(g()) should work, since g's result is of type void.
The resolution? I would lean towards f(g()) not working. Because if it
did, would you then want to support:
f(int); // actually, f(int, void) if the language would support it
I'm more comfortable with void meaning "no parameters". In which case,
f(g()) is ill-formed (passing too many parameters to a function).
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk