Blog
Const Armageddon
Date: 7/4/2011
Tags: code
So after getting about 9000 warnings building Lgi with the latest XCode 3.x I decided that I would do something about it. A lot of the warnings consisted of "casting from const char* to char* is deprecated" because I was passing a string constant into a char* arg. So I fix one of those. Which causes 4 more. And so I fix some more of those, and it snowballs... and snowballs... and then there is an avalanche of API's getting 'const' all through them. Many days latter I'm now back on top of the warnings. However now I've modified a number of base classes with virtual functions that had char* arguments. Of course the compiler doesn't warn you when your child class stops overriding the parent function does it! So the big hunt for mis-matched function definitions begins. No doubt I'll miss some and random stuff will just stop working, because the base class got the call, not the child class. *sigh*

Update: So after finding most of the problems by bumping into them accidentally I realized that I was going to missing something important anyway. So I wrote a python script that calls ctags to extract a bunch of symbol definitions, then it parses through all those and finds all the class methods, and compares their arguments and return type with the parent classes virtual function, and spits out an error if they differ. This was great, it picked up a few methods I'd missed, and gave me confidence that I could release the next build of Scribe without having broken functionality.
 
Reply
From:
Email (optional): (Will be HTML encoded to evade harvesting)
Message:
 
Remember username and/or email in a cookie.
Notify me of new posts in this thread via email.
BBcode:
[q]text[/q]
[url=link]description[/url]
[img]url_to_image[/img]
[pre]some_code[/pre]
[b]bold_text[/b]