Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find unimplemented class methods

In my application, I'm dealing with a larger-size classes (over 50 methods) each of which is reasonably complex. I'm not worried about the complexity as they are still straight forward in terms of isolating pieces of functionality into smaller methods and then calling them. This is how the number of methods becomes large (a lot of these methods are private - specifically isolating pieces of functionality).

However when I get to the implementation stage, I find that I loose track of which methods have been implemented and which ones have not been. Then at linking stage I receive errors for the unimplemented methods. This would be fine, but there are a lot of interdependencies between classes and in order to link the app I would need to get EVERYTHING ready. Yet I would prefer to get one class our of the way before moving to the next one.

For reasons beyond my control, I cannot use an IDE - only a plain text editor and g++ compiler. Is there any way to find unimplemented methods in one class without doing a full linking? Right now I literally do text search on method signatures in the implementation cpp file for each of the methods, but this is very time consuming.

like image 253
Aleks G Avatar asked Jan 14 '13 10:01

Aleks G


1 Answers

You could add a stub for every method you intend to implement, and do:

void SomeClass::someMethod() {
    #error Not implemented
}

With gcc, this outputs file, line number and the error message for each of these. So you could then just compile the module in question and grep for "Not implemented", without requiring a linker run.

Although you then still need to add these stubs to the implementation files, which might be part of what you were trying to circumvent in the first place.

like image 108
lethal-guitar Avatar answered Oct 13 '22 00:10

lethal-guitar