|
|
|
|
|
by SkiFire13
7 days ago
|
|
Contracts are a glorified assert that can be enabled/disabled based on compilation flags. So nothing new, except it's UB to link binaries compiled with different contract modes (it isn't if you define your own assert macro!). So at the end of the day there are mostly no upsides, but you get more UB you didn't ask for. |
|
Wait, what do you mean by this? If I put an assert in an inline function in some header and compile it with and without NDEBUG in two different models, it's definitely UB. Are you saying contracts went further and made it UB to even link two binaries that compiled different functions in different modes, rather than the same functions in different modes? That sounds crazy and unnecessary if so.