By Michael Hyman, Phani Vaddadi (auth.)

C++ is the language of selection for constructing the main refined home windows courses, however it is stuffed with hidden traps for the unwary. Mike Hyman and Phani Vaddadi's no-nonsense publication is helping C++ programmers keep away from those traps through supplying helpful recommendations gleaned from a mixed 30 years of expertise. during this publication, you can find a few priceless real-world assistance and strategies to help you enhance your code and coding practices.

Show description

Read or Download Mike and Phani’s Essential C++ Techniques PDF

Similar programming: programming languages books

Essential Java Fast : How to write object oriented software for the Internet

Java is a brand new and interesting object-oriented programming language that's set to remodel the realm large net. Java permits clients to write down purposes which might be accessed throughout assorted structures and gives an efficient technique of construction small yet strong courses that allow an incredible diversity of latest purposes - similar to animation, stay updating, two-way interactions and so forth.

Designing SQL Server 2000 Databases. for .Net ™ Enterprise Servers

The Microsoft . internet initiative is the way forward for e-commerce - making it attainable for companies to construct a safe, trustworthy e-commerce infrastructure. this can be the 1st ebook to stipulate the features of SQL Server 2000, one of many key parts of . web. SQL Server 2000 introduces robust new information mining performance designed particularly to seize and technique buyer profiles and to foretell destiny deciding to buy styles on e-commerce websites.

Additional resources for Mike and Phani’s Essential C++ Techniques

Sample text

Guess which one the user receives? If you understand what type of code the compiler generates, you can learn how to write more efficient code. In this chapter, we examine a few techniques you can employ to make your code more efficient. YOU WRITE CODE IN C++. 0Derived1@@QAE@AAVO@@Z)(Ox00401019) dword ptr [ebp-188h],eax TestVirtualDTor(ox004135ad)+2C9h dword ptr [ebp-188h],o Dealing with Compiler-Generated Code 004135AD 00413583 00413589 004135(0 004135(6 mov mov mov mov mov ecx,dword dword ptr dword ptr edx,dword dword ptr ptr [ebp-188h] [ebp-168h],ecx [ebp-4],oFFFFFFFFh ptr [ebp-168h] [pd12],edx The single new looks fairly innocent.

2. Click on the C/C++ tab. 3. Select the General category. 4. Click on the Warnings as Errors checkbox. Technique 37: Always Use at Least Warning Level 3 Category: Avoid stupid mistakes It takes a lot less time to fix a warning than it does to debug code. Let the compiler do as much of the dirty work for you as possible. Warning messages that seem trivial may really be pointing out nasty potential problems. We suggest using warning level3. From the command line, use the /W3 or /W4 flag. Or, from the environment do the following: 30 l.

Unlike const, #define provides string substitution. Because the strings are substituted during the code preprocessing stage, #define can thus be used for broader circumstances, such as creating macros. You also need to use #define for making declarations easier to understand. In the example shown here, we have created a pure function. It is a lot easier to understand this when looking at the "After" example. h Technique 30: Using an Assert instead of, or in addition to, Commenting Code Category: Avoid crashes and unexpected results Before while(m_rgl[++i] < lKey); II There is no way i can go past the right II bound because lKey is picked up to be the II right most entry.

Download PDF sample

Rated 4.05 of 5 – based on 27 votes