Gennaro Prota <[EMAIL PROTECTED]> writes:
> On Tue, 03 Dec 2002 20:55:02 -0500, David Abrahams
> <[EMAIL PROTECTED]> wrote:
>
>>
>>I'd like a macro to detect that a compiler requires a return value
>>even when no paths return from a function. Example:
>>
>> int f()
>> {
>> throw "hello";
>> };
>>
>>If this fails to compile, we may need to add a dummy "return 0;" at
>>the end.
>
> I'm a little surprised by this question. Are you saying that *no*
> paths return a value and you declare the function as non void?
Yes. Actually I was wrong about aCC; it only warns. Still annoying, though.
> Maybe you were referring to a situation like this?
>
>
> // The throw is conditional, and there's at
> // least one path that does return a value
> //
> template <typename ExceptionT>
> void do_throw(ExceptionT const & ex) { throw ex; }
>
>
> int f() {
> for ( ...)
> if (...)
> return somevalue;
>
> do_throw( some_exception() );
> }
No. There are several instances like the one I cited in our test suite
(the function lib, I think).
--
David Abrahams
[EMAIL PROTECTED] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost