Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2008-05-01 15:19:11


David Abrahams wrote:
> on Mon Apr 28 2008, "Marco Costalba" <mcostalba-AT-gmail.com> wrote:
>> On Mon, Apr 28, 2008 at 6:48 PM, Steven Watanabe <watanabesj_at_[hidden]> wrote:
>>> There's a page in the proto documentation that describes a solution.
>>>
>> If the page you refer to is: "Detecting the Arity of Function Objects"
>>
>> under the link:
>>
>> http://boost-sandbox.sourceforge.net/libs/proto/doc/html/boost_proto/appendices/implementation/function_arity.html
>>
>> Then I have to say: WOW !!!!!! this is metaprogramming virtuosism to
>> the highest level.
>
> Isn't there the issue that passing non-PODs through ... is undefined
> behavior (note that the standard doesn't say you have to execute the
> code to cause the undefined behavior, and GCC will warn about it IIRC)?
> I avoided it for that reason in boost/detail/is_incrementable.hpp.

If it's in a non-evaluated context (e.g., sizeof expressions), GCC
doesn't issue a warning. I think C++03 is silent on this matter, and I
remember some discussion of the issue for C++0x, the result of which was
that doing this in non-evaluated contexts was OK, but I could be
misremembering.

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

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