Menu

#97 add a note that lib used to support non-macro API

1.0.0
new
None
Documentation
minor
0.4.1
task
2012-09-10
2012-09-10
No

Add a note that lib used to support non-macro API which was later abandoned (just mentioning this in the Release Notes section makes it too hidden).

Also let's keep in mind that contracts should be specified at the
declaration site. In any case, this is the best I was able to do
without using macros (rev 0.3.490 of the lib that still supported the
non-macro API):
http://contractpp.svn.sourceforge.net/viewvc/contractpp/releases/contractpp_0_3_490/doc/html/contract__/without_the_macros.html

Essentially this used function pointers (I guess you could similarly
use functors) to pass to the lib the functions that checked
pre/post/etc so the lib could check. This was abandoned because of the
large amount of boiler-plate code that users have to program,
including repeating the function signature a few times to program the
pre/post/body/etc functions to pass to the lib. Also subcontracting
relied on the user repeating bases classes everywhere making the code
very hard to maintain. Finally, disabling the contract code on
compilation (i.e. removing the pre/post/body/etc functions/functors)
required the user to manually program #ifdef and the all thing got
pretty ugly.

I don't see how C++11 could improve this (also lambdas can't be used in declarations which is were contracts belong).

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.