I would like to do this for usages whi开发者_开发知识库ch may be inefficient but not necessarily incorrect.
No.
An assertion failure indicates a problem preventing the program from being completed (be that execution [run-time assertions], or compilation [static assertions]).
In truth, an implementation is allowed to do anything as long as they emit a diagnostic (including continuing execution). But, in practice, mainstream toolchains will all behave pretty much the same: they will error out. You certainly can't hack them to something user-defined.
The attributes are introduced in C++0x for that purpose. See http://docwiki.embarcadero.com/RADStudio/en/C%2B%2B0x_attribute_deprecated for an example.
Not as Standard, no. You can find #warning
in many compilers, but that's really not the same in most situations.
精彩评论