logoalt Hacker News

steveklabnikyesterday at 4:42 PM1 replyview on HN

C++ contracts are not a compile-time construct, they're a runtime construct.

Take the example from the article. The contract trips at runtime, not at compile time.


Replies

bluGillyesterday at 4:54 PM

The only required enforcement is runtime (even then it is optional). However nothing stops the compiler from detecting a violation at compile and time failing because of an error (or perhaps warning?)

There is a lot of interest in static analysis enforcing contracts, but this will likely require some additions to the contract specification.

show 1 reply