Title :
Another mediocre assertion mechanism for C++
Author :
Guerreiro, Pedro
Author_Institution :
Dept. de Inf., Univ. Nova de Lisboa, Caparica, Portugal
Abstract :
Assertions are a basic programming ingredient. If the language being used does not support them in a proper way, then you must at least use some kind of standardized comments to express things like preconditions for functions. The comments can be turned into executable functions by a preprocessor, but we could write the function calls directly, with the advantage of having the compiler check their syntax. This technique can be used with C++ to emulate the full set of assertions used in Eiffel to implement Design by Contract. The assertion functions are grouped in a class (Assertions class), which is inherited by the classes whose functions we want to assert. The assertions can be turned on and off, object by object, during the execution of the program. The system works well under inheritance, although some guidelines must be followed when writing postconditions on the base class. The simplicity of this mechanism makes it possible to comment out all or some of the assertions automatically through the programming environment
Keywords :
C++ language; inheritance; object-oriented programming; Assertions class; C++ language; Design by Contract; Eiffel; assertion functions; assertions; basic programming ingredient; compiler; executable functions; function calls; inheritance; mediocre assertion mechanism; postconditions; preconditions; preprocessor; programming environment; standardized comments; Computer bugs; Emulation; Guidelines; Independent component analysis; Java; Logic programming; Programming environments; Switches; Text processing; Writing;
Conference_Titel :
Technology of Object-Oriented Languages, 2000. TOOLS 33. Proceedings. 33rd International Conference on
Conference_Location :
Mont-Saint-Michel
Print_ISBN :
0-7695-0731-X
DOI :
10.1109/TOOLS.2000.848764