From: Aitor Garay-R. <ter...@gm...> - 2004-05-10 17:51:34
|
Hi there!, Lately I have been thinking on how it could be possible to implement an iContract like tool for C++. iContract is a Design by Contract tool for Java. The basic idea is to parse the C++ source code looking for special comment blocks that specify the precondition/postcondition/invariants of the class. Then the input source code is extended with code that check the contracts at runtime. There are a few options for implementing such a DbC tool for C++. I have come to OpenC++ and believe that is the most promising way to implement it "easily". Other alternatives I'm considering are implementing a standalone application that uses some freely available grammar or may be extending the AspectC compiler. I have no experience at all with OpenC++ and I have a few doubts. - do OpenC++ meta-programs have access to the source code comments? - are the meta-programs able to transverse the inheritance hierarchy of a given class? - how well does OpenC++ handle macros? And namespaces? - is it possible to introduce new methods in the generated classes? Is it possible to do arbitrary transformations like nesting the body of a method inside some try/catch blocks? Sorry for the long list of questions, it would be very helpful if I can get a rough idea of OpenC++ possibilities before getting deep into it. Has someone hear about some similar effort of implementing DbC for C++? Any ideas? Thanks!, /AITOR |