On Oct 24, 2013, at 7:13 PM, G M <[email protected]> wrote:
>> Hi
>> I don't understand this code:
>>
>> _LIBCPP_NEW_DELETE_VIS void* operator new(std::size_t __sz)
>> #if !__has_feature(cxx_noexcept)
>> +#if defined(_LIBCPP_MSVC)
>> + throw(...)
>> +#else
>> throw(std::bad_alloc)
>> #endif
>> +#endif
>> ;
>>
>> Are you anticipating that operator new will throw things other than
>> std::bad_alloc?
>> Or does MSVC just hate exception specifications?
>> [ I'm not really that fond of them, but still …. ]
>
> Yes I thought the code was a bit weird to begin with too. I'm just adding
> more of the same. But I think the logic is something like, "exception
> specifications are deprecated/going away, if the compiler is aware that we
> don't need them, don't use them. If the compiler isn't aware that we don't
> need them, use what we know works. for clang that's throw x; meaning we throw
> x; for msvc that's throw(...) meaning say we throw something, but I don't
> know what and don't support a meaning of saying what.".
>
> It's the only place this type of thing is used, so there isn't any value
> supporting some kind of clever macro for that. The whole ugliness will go
> away for all compilers soon enough I think.
How about just say:
#if !defined(_LIBCPP_MSVC)
throw(std::bad_alloc)
#endif
and for MSVC just not have a throw spec?
-- Marshall
Marshall Clow Idio Software <mailto:[email protected]>
A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly
moderated down to (-1, Flamebait).
-- Yu Suzuki
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits