Home Books Ebooks C-and-C++-books C and C++ books-page6
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

C and C++ books-page6

Advertisement
The two functions DOMString.transcode() and XMLString::transcode() return arrays of raw data, in the first case a char * (an old-fashioned C string) and in the second case a zero-terminated array of XMLCh's.

C and C++ books-page6

     

  1. The Refactoring C++ Code 
    The two functions DOMString.transcode() and XMLString::transcode() return arrays of raw data, in the first case a char * (an old-fashioned C string) and in the second case a zero-terminated array of XMLCh's. You need to use the first to get data from your XML file into the native character set to display in a GUI. In my case I build clickable lists of items in my Mac and Windows app from stuff that is spelled out in an XML file, and the labels of buttons and so on are taken from element attributes. You need the second to tranform C string constants into DOMStrings so you can use them to find elements and attributes - the DOMString constructor takes an XMLCh* as its parameter. 
       
  2. The Pointer to C++ Member Function
    Pointers to Member Functions are one of C++'s more rarely used features, and are often not well understood even by experienced developers. This is understandable, as their syntax is necessarily rather clumsy and obscure. Member function pointers are important because they provide an efficient way to cache the outcome of a decision over which member function to call. They can save time, and in some cases, provide a design alternative that avoids the need to implement such decision caching through memory allocation. I will return to this further on.
      
  3. The Concerning C++ integral data types
    C++ allows the use of some predefined types, such as the int type. It is, as its name suggests, a type able to represent integers, or, better, a finite subset of whole numbers. In general, you can use more than one type of integers, for example short int, int, long int, each with its own size, but, take care, it's not always true that short int, int and long int have three different sizes. The lowest and highest integers that can be represented inside a machine, let's say of type int, depend both on the form in which the numbers themselves are represented and, above all, on the amount of memory used to store them.
      
  4. The Scientific C++ for techniques
    Every compiler supports a different subset of the ISO/ANSI C++ standard. Trying to support a C++ library or program on many platforms is guaranteed to be a major headache. Most compilers are disappointingly poor at optimizing C++. Traditional optimization techniques need to be modified to work with nested aggregates and temporary objects, which are very common in C++. An exception is KAI C++, which is a top-notch optimizing C++ compiler. Another exception is the SGI C++ compiler, which does a reasonably good job.

      
Advertisements

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: October 8, 2010

Ask Questions?    Discuss: C and C++ books-page6  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com