logoalt Hacker News

spacechild1yesterday at 8:54 PM1 replyview on HN

Pre- and postconditions are actually part of the function signature, i.e. they are visible to the caller. For example, static analyzers could detect contract violations just by looking at the callsite, without needing access to the actual function implementation. The pre- and postconditions can also be shown in IDE tooltips. You can't do this with your own contracts implementation.

Finally, it certainly helps to have a standardized mechanisms instead of everyone rolling their own, especially with multiple libraries.


Replies

kevin_thibedeautoday at 12:34 AM

Is a pointer parameter an input, output, or both?

show 1 reply