Reputation: 23135
I would like to do this for usages which may be inefficient but not necessarily incorrect.
Upvotes: 13
Views: 1127
Reputation: 385284
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.
Upvotes: 6
Reputation: 5225
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.
Upvotes: 3
Reputation: 146978
Not as Standard, no. You can find #warning
in many compilers, but that's really not the same in most situations.
Upvotes: 0