[Development] Proposal: adding Q_DECL_NOEXCEPT to many methods

marius.storm-olsen at nokia.com marius.storm-olsen at nokia.com
Thu Aug 2 19:50:05 CEST 2012


On 02/08/2012 12:39, ext marius.storm-olsen at nokia.com wrote:
> On 02/08/2012 12:32, ext marius.storm-olsen at nokia.com wrote:
>> On 02/08/2012 12:19, ext Thiago Macieira wrote:
>>> On quinta-feira, 2 de agosto de 2012 17.15.26, marius.storm-olsen at nokia.com
>>> wrote:
>>>> So, perhaps we can identify the cases where they are similar and use
>>>> that with MSVC until proper noexcept()/noexcept(<type>) support is provided?
>>>
>>> Yes. I can identify where they are similar: nowhere.
> ...
>> So, i.o.w. throw() == __declspec(nothrow), which in turn means
> ...
>> So no, throw() will effectively remove all checking for exceptions.
>
> I see that we cannot use throw(<type>) though, since MSVC simply turns
> that into throw(...), which is not what you want.

So, perhaps we can use something like

#if defined(Q_CC_MSVC)
#  define Q_DECL_NOEXCEPT throw()
#  define Q_DECL_NOEXCEPT_TYPE(x)
#elif defined(QT_CXX_EXCEPTIONS)
#  define Q_DECL_NOEXCEPT noexcept(true)
#  define Q_DECL_NOEXCEPT_TYPE(x) noexcept(x)
#else
#  define Q_DECL_NOEXCEPT
#  define Q_DECL_NOEXCEPT_TYPE(x)
#endif

-- 
.marius



More information about the Development mailing list