Applied C++: Practical Techniques for Building Better by Philip Romanik, Amy Muntz

By Philip Romanik, Amy Muntz

This e-book is ready using C++ to unravel the issues inherent in construction advertisement software program. these of you who've labored on engineering groups construction complicated software program will recognize precisely what we suggest by way of calling it advertisement software program.

Show description

Read or Download Applied C++: Practical Techniques for Building Better Software PDF

Similar c & c++ windows programming books

The standard C library

Prentice Hall's most crucial C programming name in years. A significant other quantity to Kernighan & Ritchie's c language. a suite of reusable services (code for development facts buildings, code for appearing math services and medical calculations, and so on. ) for you to retailer C programmers money and time specifically whilst engaged on huge programming tasks.

C++ in a Nutshell

To-the-point, authoritative, no-nonsense suggestions have consistently been an indicator of O'Reilly books. The In a Nutshell books have earned an effective popularity within the box because the well-thumbed references that sit down beside the an expert developer's keyboard. C++ in a Nutshell lives as much as the In a Nutshell promise.

ASP.NET 2.0 Revealed

* in addition to those that obtain the preview at PDC, it's expected that every one different ASP. web builders may be hungry for info at the new edition. * can be one of many first actual books on ASP. web 2. zero, to be had once the expertise itself turns into to be had to a much broader viewers. * Very fast paced, since it assumes earlier wisdom of ASP.

Pro SharePoint 2013 Branding and Responsive Web Development

Professional SharePoint 2013 Branding and Responsive net improvement is the definitive reference at the applied sciences, instruments, and methods wanted for construction responsive web pages and purposes with SharePoint 2013. The booklet specializes in recommendations that supply the simplest browser adventure for the myriad of units, browsers, and reveal orientations and resolutions.

Additional info for Applied C++: Practical Techniques for Building Better Software

Sample text

In actuality, prototyping is an iterative process with the design and implementation phases. By clarifying the most difficult aspects of the design, prototyping can actually result in avoiding costly mistakes and bringing the product in on time. 3 Our Image Framework Prototyping Strategy In Chapter 2, we showed our first attempt to design an image object to handle the simple problem of generating a thumbnail image. We presented this test application to show how easy it is to design an object that solves a simple problem.

The full base class definition is shown here. template class apAllocatorBase_ { public: apAllocatorBase_ (unsigned int n, unsigned int align) : pRaw_ (0), pData_ (0), ref_ (0), size_ (n), align_ (align) {} // Derived classes alloc memory; store details in base class virtual ~apAllocatorBase_ () {} // Derived classes will deallocate memory operator T* () { return pData_;} operator const T* () const { return pData_;} // Conversion to pointer of allocated memory type unsigned int size () const { return size_;} // Number of elements unsigned int ref () const { return ref_;} // Number of references unsigned int align () const { return align_;} // Alignment void addRef () { ref_++; } void subRef () { --ref_; if (ref_ == 0) delete this; } // Increment or decrement the reference count protected: virtual void allocate () = 0; virtual void deallocate () = 0; // Used to allocate/deallocate memory.

Many libraries require memory alignment to avoid the performance hit of copying images. We use the pRaw_ pointer (defined as a char*) for the allocation, and then align and coerce the pointer to be compatible with pData_: pRaw_ = new char [sizeof(T) * size_ + (align_ - 1)]; pData_ = alignPointer (pRaw_); Our base class provides a function, alignPointer(), to handle the alignment and conversion to type T*. We saw how this function can alter the memory address by up to (align_-1) bytes during alignment.

Download PDF sample

Rated 4.96 of 5 – based on 15 votes