You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When c++ exceptions are not turned on, compiling some c++ code may result in c++ exception warnings, especially on msvc, for example:
If no flags are set, msvc disables c++ exceptions by default, unless the user sets /Ehsc, and then vs adds this flags by default.
In xmake, it is common to not add any flags whenever possible, but at the moment, given that most c++ projects require the use of exceptions, c++ exceptions are turned on by default in order to avoid msvc warnings.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
When c++ exceptions are not turned on, compiling some c++ code may result in c++ exception warnings, especially on msvc, for example:
If no flags are set, msvc disables c++ exceptions by default, unless the user sets /Ehsc, and then vs adds this flags by default.
In xmake, it is common to not add any flags whenever possible, but at the moment, given that most c++ projects require the use of exceptions, c++ exceptions are turned on by default in order to avoid msvc warnings.
xmake/xmake/rules/c++/xmake.lua
Lines 39 to 41 in 80af97d
But user can also disable it in own project. like this
This is the current default behaviour, do we need to keep the current default behaviour or disable c++ exceptions by default?
当前的版本默认会启用 c++ 异常,如果用户没有设置任何 c++ 异常 Flags,那么默认就会启用它,对于 msvc 会添加 /Ehsc flags。
当然用户可以显式通过
set_exceptions("none")
在自己的工程中禁用它。xmake/xmake/rules/c++/xmake.lua
Lines 39 to 41 in 80af97d
我们是否需要修改这种行为,改成默认禁用 c++ 异常,不添加任何 flags,仅仅让用户自己去启用 c++ 异常。
set_exceptions("cxx")
目前 vs 里面默认是开启的,并且如果不开异常的,编译一些 c++ 代码,会有警告提示。
72 votes ·
Beta Was this translation helpful? Give feedback.
All reactions