HP C/aC++ for PA-RISC Software Migration Considerations Related to Preprocessing, Header File

Page 208

Standard Components Library Not Provided

The Standard Components Library is not provided with the HP aC++ compiler for Integrity servers. HP recommends that you use the similar features of the Standard C++ Library in place of the Standard Components Library.

HP C++ (cfront) Complex Library Not Supported

The Complex library which is part of the cfront based HP C++ compiler product is not included with HP aC++. HP recommendeds that you use the similar features of the Standard C++ Library in place of the Complex library.

Complete the following procedure to begin migration:

1.Replace #include with <complex>.

2.Remove -lcomplexfrom the command-line.

Manpages

The following manpages describe the complex library are not part of the HP aC++ product. These manpages are no longer available.

CPLX.INTRO(3C++) - Introduction to The C++ Complex Mathematics Library

cartpol(3C++) - Partesian and Polar Functions

cplxexp(3C++) - Exponential, Logarithm, Power, and Square Root Functions for Complex Numbers

cplxerr(3C++) - Error Handling Function

cplxops(3C++) - Complex Number Operators

cplxtrig(3C++) - Trigonometric and Hyperbolic Functions for Complex Numbers

Header File

The Complex library uses the complex.h header file.

HP C++ (cfront) Task Library Not Supported

The task library, that is part of the HP C++, is not included with HP aC++. To develop multi-threaded applications with HP aC++, use the pthreadprogramming interface routines that are available as part of HP DCE/9000.

Manpages

The following manpages describe task library features are not part of the HP aC++ product. These manpages are no longer available.

TASK.INTRO(3C++) - Introduction to the C++ Task Library

interrupt(3C++) - Signal Handling

queue(3C++) - Queue Routines for Message Passing and Data Buffering

task(3C++) - the C++ task library

tasksim(3C++) - Histograms and Random Numbers for Simulations with C++ Tasks

Migration Considerations Related to Preprocessing

The HP C++ (cfront) compiler provides ANSI mode (the default) and K&R compatibility mode preprocessing. HP aC++ preprocessing complies with the ANSI/ISO C++ International Standard. Therefore, if you are migrating from cfront ANSI mode preprocessing to HP aC++, in general, no changes are required.

HP aC++ does not support K&R compatibility mode preprocessing.

208 Migrating from HP C++ (cfront) to HP aC++

Image 208
Contents HP aC++/HP C A.06.28 Programmers Guide Page Contents +FP Contents Contents Contents Pragma Directives and Attributes Initialization and Termination PragmasCopyright Notice and Identification Pragmas Data Alignment PragmasContents Preprocessing Directives 119 Using HP aC++ Templates 132 Standardizing Your Code 138Optimizing HP aC++ Programs 156 Exception Handling 161Tools and Libraries 175 170Mixing C++ with Other Languages 188 Migrating from HP C++ cfront to HP aC++ 198 Distributing Your C++ Products 195Strings 194 Arrays Files in Fortran Documentation feedback 221 Diagnostic Messages 222 Glossary 223 Index 227HP secure development lifecycle Intended Audience About This DocumentWhat’s in This Document Typographical Conventions This document uses the following conventionsPublishing History Related DocumentsHP-UX Release Name and Release Identifier HP-UX 11i ReleasesHP Encourages Your Comments Following is a list of documents available with this releaseGetting Started with HP aC++ Components of the Compilation SystemC89 C99 ecom Ctcom Other HP aC++ executable files areUsing the aCC Command Compiling a Simple ProgramExecuting the Program Debugging ProgramsCompiler Command Syntax and Environmental Variables Examples of the aCC CommandFiles on the aCC Command Line Assembly Language Source Files .s Files++ Source File .C file Preprocessed Source Files .i FilesConfiguration Files .conf Files Environment VariablesObject Files .o Files Library Files .a and .so FilesACCFULLPATHNAMES Environment Variable ACCMAXERR Environment VariableCxxopts Environment Variable Cclibdir Environment VariableCcrootdir Environment Variable ACC -L/mnt/proj/lib file.o ACC file.oFloating Installation Cxxmapfile Environment VariableTmpdir Environment Variable Export CCROOTDIR=/mnt/CXX2.1Setting up Floating Installation HP aC++Command-Line Options Options to Control Code Generation ACC -c sub.C prog.CACC +DO11.22 +O3 app.C ILP32 Data Model and LP64 Data ModelUsing +DS to Specify Instruction Scheduling Compiling in Networked EnvironmentsACC -S prog.C Data Alignment and StorageSize and Alignment of HP Compiler Data Types Debugging Options Fshort-enums+expandtypesindiag ACC +u1 app.CWhen to use -g, -g0, and -g1 Differences Between -g, -g0, and -g1 OptionsG1 Algorithm +macrodebug+noobjdebug +pathtrace+pathtrace=kind LocalError Handling None+pathtrace=globallocal ACC +p file.C+Wargs +wn+Wcontextlimit +wperfadvice +We+Weargs +WvException Handling Extensions to the Language+wsecurity +noehFloating-Point Processing Options +Onofenvaccess+Onocxlimitedrange Fpeval FpevaldecNofpwidetypes +decfp+FPmode +Onolibmerrno+Oprefetchlatency +OnopreservedfpregsHeader File Options ACC -I include file.C Idirs -I- -Idirs Online Help Option +helpInlining Options +inlinelevel numLibrary Options DynamicExec LnameLinker Options Minshared+nostl +Onolibcalls=Usymbol Usymbol+Onodynopt +OnodynoptOptions for Naming the Output File Native Language Support Option+ild +ildrelinkHandling Null Pointers Options Code Optimizing OptionsBasic Optimization Level Options ACC -z file.C+O0 +O1+O2 +O3Additional Optimization Options for Finer Control +O4ACC +O3 prog.C +O4+nonrv Ipo+Onofailsafe Advanced +Ooptimization Options +Onoaggressive+Onolimit +Onoptrstoglobals=list+Onocrossregionaddressing +Onodatalayout+Onodataprefetch +Onofltacc+Ofrequentlycalled +Onoinitcheck+Olit +Onoinline+Ointegeroverflow +Olevel +Onolooptransform+Onoloopunroll +Onoopenmp+opts +Onoparminit+Onoparmsoverlap +Onoprocelim+Onosignedpointers +Orarelycalled+Oshortdata +Otypesafety Profile-Based Optimization Options+Onostoreordering +OunrollfactorParallel Processing Options Information Embedding OptionsDisplaying Optimization Information Annotate=structsOption Matrix for -mt Required if -DPOSIXCSOURCEis used+Onoautopar +tls=staticdynamicPerformance Options +wlockFast +Ofast+Ofaster +Onotlscallschangetp+nosrcpos +DSmodelPorting Options +sb+ub +uc+w64bit +wdriver+wendian This warning can be suppressed by adding an extra castDname Preprocessor OptionsRedirecting Output From This Option Maked +Maked+maked ExamplesUname Profiling Code Options+profilebucketsize Runtime Checking Options +check+check=all +check=none+check=boundsarray +check=boundspointer Compiling with +check=boundspointerCheck off by one out-of-bounds access Check off by any number out-of-bounds access+check=globals +check=lock+check=malloc +check=stackframevariablesnone +check=thread+check=truncateexplicitimplicit +check=uninitCh = intval & 0xff +check=truncateexplicit +check=truncateimplicitAarm Standards Related OptionsAarm AC89 AC99Ag++ Agcc+legacycpp AOa and -AOe+legacyv5 +std=c89c99c++98c++11gccg++gnu +stl=rwnone+tru64 Wc,-ansiforscope,onoffWc,-koeniglookup,onoff +tru64Subprocesses of the Compiler Tx,nameMore Examples of -t Tx,nameWx,args Symbol Binding Options BdefaultBextern Passing Options to the Linker with -WBhidden BhiddendefBprotected BprotecteddataTemplate Options Trigraph Processing Suppression Option +instincludesuffixesVerbose Compile and Link Information Process Compiler 94/u 65/s 35/r 37/u 76/s 02/r ACC -V app.C Concatenating OptionsACC myfile.C -v -g1 ACC myfile.C -vg1 ACC -vg1 myfile.C Pragma Directives and Attributes Initialization and Termination PragmasCopyright Notice and Identification Pragmas Data Alignment Pragmas #pragma Versionid string#pragma Versionid Software Product, Version 12345.A.01.05 #pragma align NData Alignment Pragmas Basic Example Template ExampleImplicit Access to Unaligned Data Handling Unaligned Data#pragma unalign Typedef T1 T2 Interaction between pack and unalign pragmas is as followsOptimization Pragmas Optlevel PragmaOptimize Pragma Floattrapson PragmaNoinline Pragma Diagnostic Pragmas Other PragmasDefaultbinding Pragma Binding PragmaEstimatedfrequency Pragma Extern PragmaHdrstop Pragma Hidden PragmaHpdefinedexternal Pragma Hpdefinedinternal PragmaPOP Pragma Pragma onceProtected Pragma Ptrsstronglytyped Pragma#pragma Stdc FLOATCONSTDECIMAL64 on OFF Default Stdc Cxlimitedrange PragmaStdc FLOATCONSTDECIMAL64 Pragma Stdc Fpcontract PragmaUnrollfactor Pragma Stdc Fenvaccess PragmaOMP Atomic Pragma OMP Barrier Pragma OMP Critical PragmaOMP for Pragma OMP Flush PragmaOMP Master Pragma OMP Ordered PragmaOMP Parallel Pragma OMP Parallel for PragmaOMP Parallel Sections Pragma OMP Sections PragmaOMP Single Pragma OMP Task PragmaOpenMP Clauses Default CopyprivateShared CopyinAttributes Attribute nonexposing Attribute noreturnAttribute nonexposing Attribute noreturnAttribute visibility Attribute formatAttribute warnunusedresult Preprocessing Directives Overview of the PreprocessorSyntax Usage GuidelinesSource File Inclusion #include, #includenext SyntaxDescription Assertions #assert, #unassertMacro Replacement #define, #undef #define mac very very long\ Replacement stringExamples Macros with ParametersSpecifying String Literals with the # Operator Concatenating Tokens with the ## OperatorExample Following illustrates the ## operatorUsing Macros to Define Constants Other MacrosVar1 is #define Arraysize 1000float xARRAYSIZEUsing Constants and Inline Functions Instead of Macros Assertions #assert, #unassert Predefined MacrosHP aC++ predefines the following predicates Conditional Compilation #if, #ifdef, .. #endifCode that compiles if the expression evaluates to zero Using the defined Operator Using the #if DirectiveUsing the #ifdef and #ifndef Directives Using the #else DirectiveExample Line Control #line#line 5 myfile This macro enables the following non-standard features Iostream Performance Improvement PragmaPragma Directive #pragma and Pragma Operator See page 96 for more information on pragmasError Directive #error Trigraph SequencesExamples Line below contains the trigraph sequence ??=When this line is compiled it becomes ??=line 5 myfileUsing HP aC++ Templates Invoking Compile-Time InstantiationScope and Precedence Template ProcessingExplicit Instantiation UsagePerformance Template class TablecharCommand-Line Option Instantiation Compile-Time InstantiationFunction Template ACC -c +instcompiletime a.C ACC -c a.CWhy Use Compile-Time Instantiation Possible Duplicate Symbols in Shared LibrariesPossible Duplicate Symbols in Archive Libraries Scope++ Template Tutorial Class TemplatesBuilding an Archive Library with +instauto/+instclose Building an Archive Library with Compile-time InstantiationFunction Templates Standardizing Your Code HP aC++ KeywordsBool Keyword HP aC++ KeywordsCompile time error message is Dynamiccast KeywordAbove generates a compile-time error Explicit Keyword Classic example of this problem is an array class Mutable Keyword Namespace and using Keywords Connections Across Translation UnitsUsing- declarations and using- directives Using Nx // Where N is a namespace, x is a name in NAn Auxiliary Translation Unit IntPage Class Base Virtual void f Must have a virtual function to Volatile Keyword Template Keyword Wchart KeywordTypename Keyword Use it as the name of the template C below Overloading new and delete for ArraysDeclare a class as a member of the class template C2 below Example Standard Exception Classes RangeerrorInvalidargument Typeinfo Class Exceptions Thrown by the Standard C++ LibraryFollowing exceptions are thrown by the Standard C++ Library Unsupported Functionality Int before const typeinfo& constMemfun1reft Memfunreft Iostream Setting Basic Optimization Levels Optimizing HP aC++ ProgramsRequesting Optimization Level 1 OptimizationAdditional Options for Finer Control Level 3 OptimizationLevel 4 Optimization Enabling Aggressive OptimizationsRemoving Compilation Time Limits When Optimizing Profile-Based OptimizationEnabling Only Conservative Optimizations Limiting the Size of Optimized CodeInstrumentation Collecting Data for ProfilingMaintaining Profile Data Files Sample.exe input.file1 Sample.exe input.file2Pragmas That Control Optimization Performing Profile-Based OptimizationACC -o sample.exe +Oprofile=use +O3 sample.C See Optimization Pragmas page 103 for more informationException Handling Exception Handling in C++Basic Exception Handling Example Function Try Block ExamplesUsing Threads Using LocksDebugging Exception Handling Performance Considerations Rogue Wave Standard C++ LibraryRequired Command-line Options Rogue Wave Standard C++ LibraryRogue Wave Standard C++ Library 1.2.1 and Tools.h++ LpthreadThis option applies only to kernel threadsUsing -DTHREADSAFE with the cfront Compatible libstream Using -DHPACCTHREADSAFERBTREELimitations Cout endlException Handling Pthreads Posix ThreadsACC -mt prog.c Function Scoping Parallel Programming Using OpenMPOpenMP Implementation OpenMP Library OpenMP Header FileOpenMP APIs are defined in the library libomp +Onoopenmp Command Line Option Environment Variables in OpenMPOpenmp Macro Where, kind is either of of static, dynamic, or guidedRuntime Library Functions in OpenMP Execution Environment FunctionsExport OMPDYNAMIC=value Setenv Ompdynamic value Export OMPNESTED=value Setenv Ompnested valueOmpsetnumthreads OmpgetnumthreadsOmpgetmaxthreads OmpgetthreadnumLock Functions OmpsetdynamicOmpgetdynamic OmpsetnestedOmpinitlock and ompinitnestlock Ompdestroylock and ompdestroynestlockOmpsetlock and ompsetnestlock Ompunsetlock and ompunsetnestlockTiming Functions Omptestlock and omptestnestlock FunctionsOmpgetwtime OmpgetwtickHP Specific Features of lex and yacc Creating and Using LibrariesTools and Libraries Locale directive for lexIntroduction to Using the Standard C++ Library HP aC++ LibrariesStandard C++ Library IntroductionDifferences between Standard C++ Library and Other Libraries Non-Object-Oriented Design of the Standard C++ LibraryStandard C++ Library Reference Incompatibilities Between the Library and the StandardACC -DHPACCUSINGMULTIPLIESINFUNCTIONAL test.c Tools.h++ LibraryHP aC++ Runtime Support Library IOStream LibraryCreating and Using Shared Libraries Linking to C++ LibrariesLinking with Shared or Archive Libraries Specifying Other LibrariesUsing a Shared Library Example of Creating and Using a Shared LibraryCreating a Shared Library Linking Archive or Shared LibrariesForcing the Export of Symbols in main Advanced Shared Library FeaturesUpdating a Shared Library Binding Times Side Effects of C++ Shared LibrariesRoutines and Options to Manage C++ Shared Libraries Linker Options to Manage Shared LibrariesStandard HP-UX Libraries and Header Files Allocation Policies for ContainersFor -AA Standard Library For a string typeHP aC++ File Locations HP aC++ Executable FilesUsr/lib/hpux##/libCsup.so HP aC++ Runtime Libraries and Header FilesUsr/lib/hpux##/libCsup11.so ISO C++11 standard compliant Calling Other Languages Mixing C++ with Other LanguagesData Compatibility between C and C++ Using the extern C Linkage Specification HP aC++ Calling HP CSyntax of extern C Examples of extern CMain Function Differences in Argument Passing ConventionsExamples HP aC++ Calling HP C Running the Example HP C Calling HP aC++Enter the nameJoann Joann has a balance To compile the example, run the following commands Compiling and Running the Sample ProgramsUsing Reference Variables to Pass Arguments Calling HP Fortran 90 from HP aC++Function Naming Conventions Example of Reference Variables as ArgumentsUsing extern C Linkage StringsArrays Files in FortranDistributing Your C++ Products Applications that use HP aC++ Shared LibrariesLinking Your HP aC++ Libraries with Other Languages Installing your ApplicationHP aC++ Files You May Distribute Terms for Distribution of HP aC++ Files Migrating from HP C++ cfront to HP aC++ General Guidelines for MigrationGetting Started with Migration CC +p cfrontfile.CCommand-Line Differences New Command-Line OptionsWriting Code for both Compilers Explicit Loading and Unloading of Shared LibrariesObsolete Command-Line Options Describes obsolete command-line options for HP aC++Changed Command-Line Options PtvMigration Considerations when Debugging Migration Considerations when Using Exception HandlingException Handling is the Default See Debugging Options page 35 for complete informationPossible Differences when Exiting a Signal Handler Memory Allocation Failure and operator newDifferences in setjmp/longjmp Behavior Calling unexpectedUnreachable catch Clauses Throwing an Object having an Ambiguous Base ClassMigration Considerations when Using Libraries Standards Based LibrariesHP C++ cfront Compatibility Libraries Fstream3C++ iostream and streambuf specialized to filesManip3C++ iostream manipulators Man 3s filebufMigration Considerations Related to Preprocessing HP C++ cfront Complex Library Not SupportedHP C++ cfront Task Library Not Supported Replace #include with complexMigration Considerations Related to Standardization Obsolete Preprocessor OptionsChanges in C++ Semantics Implicit Typing of Character String LiteralsOverload Resolution Ambiguity of Subscripting Operator Execution Order of Static Constructors in Shared LibrariesMore Frequent Inlining of Inline Code Changes in C++ SyntaxExplicit int Declaration For Statement, New Scoping Rules Struct as Template Type Parameter is PermittedEquivalent, valid HP aC++ code follows WC,-ansiforscope,onThis code compiles without error with HP aC++ Base Template Class Reference Syntax ChangeTokens after #endif Overload not a KeywordStatic Member Definition Required Dangling Comma in enumDeclaring friend Classes Using in Class Definitions Incorrect Syntax for Calls to operator newDuplicate Formal Argument Names Ambiguous Function or Object DeclarationOverloaded Operations ++ Reference InitializationUsing operator new to Allocate Arrays On HP aC++, the following error is generatedCompiling this code HP aC++ generates the following error Parentheses in Static Member Initialization ListQualified-id Required in Static Member Initialization List Non-constant Reference InitializationMigration Considerations when Using Templates Verbose Template Processing InformationDigraph White Space Separators CA aCommon Template Migration Syntax Changes Converting Directed Mode to Explicit InstantiationCfront Implicit Include Convention Documentation feedback AC++ Message Catalog Diagnostic MessagesFrequently Encountered Messages Glossary AggressiveInternational Standard defines only synchronous exceptions See template Glossary Symbols IndexCrootdir FLOATTRAPSON, 103 FREQUENTLYCALLED, 106 HDRSTOP, 107 Hidden Index
Related manuals
Manual 15 pages 49.53 Kb