Using CodeBlocks 10.05 – Part 4

The testing of my book,  C++ All-In-One Desk Reference For Dummies, for use with CodeBlocks 10.05 continues. I introduced this new version in Using CodeBlocks 10.05 – Part 1, where I discussed the general look of the new version.This post concerns Book IV Chapter 2 (found in \Author\BookIV\Chapter02).

On page 431 you see the explanation of the LValueAndRValue example. This example is supposed to fail in a specific way and it still does just as the book specifies, but with a different error message. I’ve pointed out a few other error message changes in other posts (you can see the entire list of posts for this book in the Category Archive for C++ All-in-One for Dummies). In this case, the error message has changed to:

 

error: lvalue required as left operand of assignment


The change isn’t a big one, but some readers could find it confusing. A few readers have asked how you’d fix the example. Well, you’d make DontKnow() to look like ChangeMe() as shown here:

int &DontKnow()
{
    return uggle;
}

The StaticCast example shown on page 437 is designed to show a warning message in its final form. This warning message is the same in CodeBlocks 10.05:

 

warning: unused variable ‘f’

Some readers are confused about how to get the error message described in the book. It may have been best in this case to provide two examples on the disk. However, you can easily change this example to fail as described on page 437. Simply change line 6 of the code to look like this:

class AnotherType {}; //: public FinalType {};

However, when you try to compile the example, you’ll find that CodeBlocks 10.05 again changes the message slightly. In this case, you’ll see:

 

error: invalid static_cast from type ‘AnotherType*’ to type ‘FinalType*’


The differences are small in this chapter, but worth noting. CodeBlocks 10.05 attempts to make the error messages easier to read. If you see small differences in the error messages and you’re using CodeBlocks 10.05, there is probably nothing to worry about. Please do contact me if you have major concerns about a CodeBlocks 10.05 different at John@JohnMuellerBooks.com.