C++
  Home arrow C++ arrow Temporary Variables: Procrastination is th...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
C++

Temporary Variables: Procrastination is the Thief of Time
By: J. Nakamura
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2005-09-19

    Table of Contents:
  • Temporary Variables: Procrastination is the Thief of Time
  • Temporary Object Terminology
  • More than just a call
  • To return or not to return an object
  • Visualizing the unseen object
  • Back to the closest Enemy

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
    Iron Speed
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Temporary Variables: Procrastination is the Thief of Time


    (Page 1 of 6 )

    C++ is a powerful programming language to learn, in part because it gives you full control over memory management. This is a two-edged sword, however; it lets you improve the performance of your code, but it also lets you shoot yourself in the foot. Therefore, it is important to understand the C++ compiler. This article examines how and why the compiler creates temporary objects, among other topics.

    Performance is wasted when you know the value of everything but the price of nothing.

    Introduction

    It is not too difficult to learn a programming language like C++ when you are already familiar with another object oriented programming language such as Java or C#. Just don’t mistake the knowledge of syntax for the knowledge of semantics, because once you’ve learned the C++ syntax your programming journey is only about to begin. After you have dealt with the books and courses that help you to teach yourself C++, you will discover a need for other books that help you to become effective and exceptional at it.

    One of the reasons that the C++ programming language is so powerful is because it is a very flexible language. It extends C with numerous higher level programming concepts, but remains lean and mean enough for your application to maintain good performance.

    Where other languages try to make life easier for a programmer by offering features like garbage collection (which seems to be part of every new programming language these days), C++ gives you full control over memory management and basically everything else. All these "safety" features offered by other languages suffer from one thing: performance.  The reason for this is that you will need fine-grained control over the final machine code that is going to run on your target platform if you want to be able to maximize performance. This is the same gun that allows you to shoot yourself in the foot… the same gun that can make C++ so powerful.

    Understanding the compiler is an important step in our semantic journey. Luckily we do not have to learn the behavior of all C++ compilers, since the C++ Standard binds them all in their functionality and behavior. In this article we are going to examine temporary objects: how and why the compiler creates them, why they can be useful, when they should be avoided and how we can help the compiler to optimize our code to make them go away.

    More C++ Articles
    More By J. Nakamura


     

    C++ ARTICLES

    - Large Numbers
    - Dijkstra`s Shunting Algorithm with STL and C...
    - Brief Introduction to the STL Containers
    - The Standard Template Library
    - Templates in C++
    - C++ Programmer Alerts
    - C++ Programming Tips
    - First Steps in (C) Programming, conclusion
    - First Steps in (C) Programming, continued
    - First Steps in (C) Programming, introduction
    - C++ Preprocessor: Always Assert Your Code Is...
    - C++ Preprocessor: The Code in the Middle
    - Programming in C
    - Temporary Variables: Runtime rvalue Detection
    - Temporary Variables: Chasing Temporaries Away







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway