|
Boost : |
From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2003-01-28 06:43:27
On Mon, 27 Jan 2003 18:40:02 +0100, Gennaro Prota
<gennaro_prota_at_[hidden]> wrote:
>On Mon, 27 Jan 2003 13:25:52 +0200, "Peter Dimov" <pdimov_at_[hidden]>
>wrote:
>
>>However, there is a difference. Whether p->f() invokes undefined behavior is
>>determined by the value of p (i.e., at runtime.) Whether passing x to an
>>ellipsis invokes undefined behavior is determined by the type of x (i.e. at
>>compile time.)
>
>Right. But whether passing happens or not depends on what you mean by
>"passing". If the meaning is just that you wrote a function call
>expression where the argument x corresponds to the ellipsis, then yes
>
> if (...)
> f(x);
>
>you have passed x here
BTW, if you just look at the function call expression, i.e. if you
forget about execution semantics, then you can only see the _static_
type of the argument expression. So you would conclude that this is
well-defined:
struct A {};
struct B : A {
B() {}
private:
B(const B&) {}
};
void variadic(...);
void f(A* p) {
variadic (*p);
}
int main() {
B b;
f(&b);
}
because the static type of the expression *p is A, which is a POD.
Genny.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk