Bug Vanquisher

4 November 2007


Filed under: C++ — Tanveer Badar @ 7:57 PM

I am very happy to announce that CPPCodeProvider is almost complete in implementation. The first beta release will be available at the download site shortly, hosted by source forge. And as time is passing, this post is becoming more and more of a wish list than some sort of release notes. A separate post on current bugs follows.

The reason it took so long to complete was due to me being lazy. The last functions were the largest to write, the hardest to work out and most important, without them it was impossible to write out a user defined type.

Also, I have done some more prettification for final code rendering. A bug which lay undiscovered so far has been fixed. It involved instantiating a type with bool which was not recognized and threw invalid_argument exception.

Two things I would like to note are: I have made the way code is indented in the output stream(s). Each class now dictates its own indentation by using tabs argument and no one else does that work for it. Additionally, if any CodeObject needs to have newline rendered after it, that newline must be rendered by the calling code because most of the time, it is out of context to know if a newline will not disturb the indentation and formatting.

After these two changes there should be no formatting problems as far as I can say. However, if you do see something messed up missing newlines or incorrect indentation, drop me a line on sourceforge about that specific CodeObject and if possible, some CodeDOM to reproduce the issue.

One more thing to note is the behavior of constructors of copying_pointer. Both constructors which take T* and T& own the passed argument. Therefore, be very careful if you do this:

copying_pointer< T > a( new T ) , b( *a );

This line will cause T to be deleted twice and if you are lucky this will be caught during debug builds. Correct way is to write

copying_pointer< T > a( new T ) , b( a );

because the copy constructor makes a copy of passed argument, hence no ownership issues. Similarly, UDT will own the destructor assigned to it. Be careful with that after memory leak is fixed.

I am also working on efficiently implementing BasicType. It’s purpose is to model primitive types which are only handful and rarely change. Therefore, it would be wise to have a cache of BasicType which handed out an object given the type name. But I will need to further investigate as it will undoubtedly introduce race conditions during cache initialization.

Also, next time there will be support to indent using either tabs or space.



  1. Hi,
    I checked out the svn-repo. and tried to build it with VC8 but gives me following error

    c1xx : fatal error C1083: Cannot open source file: ‘.\base_unittest.cpp’: No such file or directory

    Thx for your effort :)

    Comment by Adrian — 23 February 2008 @ 6:08 PM

  2. That file was never intended to get out of my private repository. :)

    Just remove the reference from the project and try again. I’ll update the project files in a few days.

    Thanks for pointing out the error.

    Comment by Tanveer Badar — 25 February 2008 @ 4:32 PM

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: