Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Fortran 90, Fortran 77, C, aC++: Exemplar Programming Guide

Chapter 8 Programming conventions for optimal code

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

This chapter discusses coding tips and common optimization problems you may encounter when developing programs for SMP servers and presents some possible solutions.

Optimization can remove instructions, replace them, and change the order in which they execute. In some cases, improper optimizations can cause unexpected or incorrect results or code that slows down at higher optimization levels. In some cases, user error can cause similar problems in code that contains syntactically-correct constructs or directives that are used improperly. If you encounter any of these problems, look for the following possible causes:

  • Aliasing

  • False cache line sharing

  • Floating-point imprecision ( roundoff error)

  • Invalid subscripts

  • Misused directives and pragmas

  • Misused memory classes

  • Triangular loops

  • Compiler assumptions

NOTE: Compilers perform optimizations assuming that the source code being compiled is valid. Optimizations done on source that violates certain ANSI standard rules can cause the compilers to generate incorrect code.
Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.