11.07.2015 Views

C166/ST10 C++ Compiler User's Manual - Tasking

C166/ST10 C++ Compiler User's Manual - Tasking

C166/ST10 C++ Compiler User's Manual - Tasking

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

MA019−012−00−00Doc. ver.: 1.70<strong>C166</strong>/<strong>ST10</strong> v8.7<strong>C++</strong> <strong>Compiler</strong>User’s <strong>Manual</strong>


A publication ofAltium BVDocumentation DepartmentCopyright © 2007 Altium BVAll rights reserved. Reproduction in whole or part is prohibitedwithout the written consent of the copyright owner.TASKING is a brand name of Altium Limited.The following trademarks are acknowledged:FLEXlm is a registered trademark of Macrovision Corporation.HP and HP−UX are trademarks of Hewlett−Packard Co.Intel is a trademark of Intel Corporation.Motorola is a trademark of Motorola, Inc.Windows is are registered trademark of Microsoft Corporation.UNIX is a registered trademark of X/Open Company, Ltd.All other trademarks are property of their respective owners.The STLport <strong>C++</strong> library has the following copyrights:Copyright © 1994 Hewlett−Packard CompanyCopyright © 1996,97 Silicon Graphics Computer Systems, Inc.Copyright © 1997 Moscow Center for SPARC TechnologyCopyright © 1999, 2000 Boris FomitchevData subject to alteration without notice.http://www.tasking.comhttp://www.altium.com


The information in this document has been carefully reviewed and isbelieved to be accurate and reliable. However, Altium assumes no liabilitiesfor inaccuracies in this document. Furthermore, the delivery of thisinformation does not convey to the recipient any license to use or copy thesoftware or documentation, except as provided in an executed licenseagreement covering the software and documentation.Altium reserves the right to change specifications embodied in thisdocument without prior notice.


CONTENTSTABLE OFCONTENTS


CONTENTSIVTable of ContentsCONTENTS


Table of ContentsVOVERVIEW1−11.1 Introduction to <strong>C++</strong> <strong>Compiler</strong> . . . . . . . . . . . . . . . . . . . . . . 1−31.2 Development Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . 1−41.2.1 The Prelinker Phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1−51.2.2 The Muncher Phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1−71.3 Environment Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1−81.4 File Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1−9••••••••LANGUAGE IMPLEMENTATION2−12.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2−32.2 <strong>C++</strong> Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2−32.3 <strong>C++</strong> Language Extension Keywords . . . . . . . . . . . . . . . . . 2−52.4 <strong>C++</strong> Dialect Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2−72.4.1 New Language Features Accepted . . . . . . . . . . . . . . . . . . 2−82.4.2 New Language Features Not Accepted . . . . . . . . . . . . . . 2−112.4.3 Anachronisms Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . 2−112.4.4 Extensions Accepted in Normal <strong>C++</strong> Mode . . . . . . . . . . . 2−122.4.5 Extensions Accepted in Cfront 2.1 Compatibility Mode . 2−142.4.6 Extensions Accepted in Cfront 2.1 and 3.0Compatibility Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2−182.5 Namespace Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2−242.6 Template Instantiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2−262.6.1 Automatic Instantiation . . . . . . . . . . . . . . . . . . . . . . . . . . . 2−272.6.2 Instantiation Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2−312.6.3 Instantiation #pragma Directives . . . . . . . . . . . . . . . . . . . 2−322.6.4 Implicit Inclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2−352.7 Predefined Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2−362.8 Precompiled Headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2−382.8.1 Automatic Precompiled Header Processing . . . . . . . . . . . 2−382.8.2 <strong>Manual</strong> Precompiled Header Processing . . . . . . . . . . . . . 2−422.8.3 Other Ways to Control Precompiled Headers . . . . . . . . . 2−432.8.4 Performance Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2−442.9 Prohibited c166 Optimizations . . . . . . . . . . . . . . . . . . . . . 2−462.9.1 ’main’ Labels in a <strong>C++</strong> Application . . . . . . . . . . . . . . . . . . 2−46


VITable of Contents2.9.2 Prohibited c166 Optimizations . . . . . . . . . . . . . . . . . . . . . 2−46COMPILER USE3−13.1 Invocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3−33.1.1 Detailed Description of the <strong>Compiler</strong> Options . . . . . . . . 3−163.2 Include Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3−1133.3 Pragmas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3−1163.4 <strong>Compiler</strong> Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3−118COMPILER DIAGNOSTICS4−14.1 Diagnostic Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4−34.2 Termination Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4−54.3 Response to Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4−64.4 Return Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4−6ERROR MESSAGESA−11 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A−32 Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A−4UTILITY PROGRAMSB−1CONTENTS1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B−32 Prelinker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B−33 Muncher . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B−5INDEX


<strong>Manual</strong> Purpose and StructureVIIMANUAL PURPOSE AND STRUCTUREPURPOSEThis manual is aimed at users of the TASKING <strong>C166</strong>/<strong>ST10</strong> <strong>C++</strong> <strong>Compiler</strong>. Itassumes that you are conversant with the C and <strong>C++</strong> language.MANUAL STRUCTURERelated PublicationsConventions Used In This <strong>Manual</strong>Chapters1. OverviewProvides an overview of the TASKING <strong>C166</strong>/<strong>ST10</strong> toolchain and givesyou some familiarity with the different parts of it and their relationship.A sample session explains how to build an application from your <strong>C++</strong>file.2. Language ImplementationConcentrates on the approach of the <strong>C166</strong>/<strong>ST10</strong> architecture anddescribes the language implementation. The <strong>C++</strong> language itself is notdescribed in this document.3. <strong>Compiler</strong> UseDeals with invocation, command line options and pragmas.4. <strong>Compiler</strong> DiagnosticsDescribes the exit status and error/warning messages of the <strong>C++</strong>compiler.AppendicesA. Error MessagesContains an overview of the error messages.B. Utitily ProgramsContains a description of the prelinker and the muncher which aredelivered with the <strong>C++</strong> compiler package.••••••••


VIII<strong>Manual</strong> Purpose and StructureRELATED PUBLICATIONS• The <strong>C++</strong> Programming Language (second edition)by Bjarne Straustrup (1991, Addison Wesley)• ISO/IEC 14882:1998 <strong>C++</strong> standard [ANSI]More information on the standards can be found athttp://www.ansi.org• The Annotated <strong>C++</strong> Reference <strong>Manual</strong>by Margaret A. Ellis and Bjarne Straustrup (1990, Addison Wesley)• The C Programming Language (second edition)by B. Kernighan and D. Ritchie (1988, Prentice Hall)• ANSI X3.159−1989 standard [ANSI]• <strong>C166</strong>/<strong>ST10</strong> C Cross−<strong>Compiler</strong> User’s <strong>Manual</strong> [TASKING,MA019−002−00−00]• <strong>C166</strong>/<strong>ST10</strong> Cross−Assembler, Linker/Locator, Utilities User’s <strong>Manual</strong>[TASKING, MA019−000−00−00]• <strong>C166</strong>/<strong>ST10</strong> CrossView Pro Debugger User’s <strong>Manual</strong> [TASKING,MA019−041−00−00]MANUAL STRUCTURE


<strong>Manual</strong> Purpose and StructureIXCONVENTIONS USED IN THIS MANUALThe notation used to describe the format of call lines is given below:{ } Items shown inside curly braces enclose a list from whichyou must choose an item.[ ] Items shown inside square brackets enclose items that areoptional.| The vertical bar separates items in a list. It can be read asOR.italicsItems shown in italic letters mean that you have tosubstitute the item. If italic items are inside squarebrackets, they are optional. For example:filenamemeans: type the name of your file in place of the wordfilename.... An ellipsis indicates that you can repeat the precedingitem zero or more times.screen fontbold fontRepresents input examples and screen output examples.Represents a command name, an option or a completecommand line which you can enter.For examplecommand [option]... filenameThis line could be written in plain English as: execute the commandcommand with the optional options option and with the file filename.IllustrationsThe following illustrations are used in this manual:This is a note. It gives you extra information.This is a warning. Read the information carefully.••••••••


MANUAL STRUCTUREX<strong>Manual</strong> Purpose and StructureThis illustration indicates actions you can perform with the mouse.This illustration indicates keyboard input.This illustration can be read as See also". It contains a reference toanother command, option or section.


CHAPTEROVERVIEW1


OVERVIEW1−2Chapter 1CHAPTER1


Overview1−31.1 INTRODUCTION TO <strong>C++</strong> COMPILERThis manual provides a functional description of the TASKING <strong>C166</strong>/<strong>ST10</strong><strong>C++</strong> <strong>Compiler</strong>. This manual uses cp166 (the name of the binary) as ashorthand notation for "TASKING <strong>C166</strong>/<strong>ST10</strong> <strong>C++</strong> <strong>Compiler</strong>". You shouldbe familiar with the <strong>C++</strong> language and with the ANSI/ISO C language.The <strong>C++</strong> compiler can be seen as a preprocessor or front end whichaccepts <strong>C++</strong> source files or sources using <strong>C++</strong> language features. Theoutput generated by cp166 is <strong>C166</strong>/<strong>ST10</strong> C, which can be translated withthe C compiler c166.The <strong>C++</strong> compiler is part of a complete toolchain. For details about the Ccompiler see the "C <strong>Compiler</strong> User’s <strong>Manual</strong>".The <strong>C++</strong> compiler is normally invoked via the control program which ispart of the toolchain. The control program facilitates the invocation ofvarious components of the toolchain. The control program recognizesseveral filename extensions. <strong>C++</strong> source files (.cc, .cxx, .cpp or .c withthe −c++ option) are passed to the <strong>C++</strong> compiler. C source files (.c) arepassed to the compiler. Assembly source files (.asm) are preprocessed andpassed to the assembler. Assembly sources (.src) are directly passed tothe assembler. Relocatable object files (.obj) and libraries (.lib) arerecognized as linker input files. Files with extension .lno and .ilo aretreated as locator input files. The control program supports options tostop at any stage in the compilation process and has options to produceand retain intermediate files.The <strong>C++</strong> compiler accepts the <strong>C++</strong> language of the ISO/IEC 14882:1998<strong>C++</strong> standard, with some minor exceptions documented in the nextchapter. With the proper command line options, it alternatively accepts theANSI/ISO C language or traditional K&R C (B. W. Kernighan and D. M.Ritchie). It also accepts embedded <strong>C++</strong> language extensions.The <strong>C++</strong> compiler does no optimization. Its goal is to produce quickly acomplete and clean parsed form of the source program, and to diagnoseerrors. It does complete error checking, produces clear error messages(including the position of the error within the source line), and avoidscascading of errors. It also tries to avoid seeming overly finicky to aknowledgeable C or <strong>C++</strong> programmer.••••••••


1−4Chapter 11.2 DEVELOPMENT STRUCTUREThe next figure explains the relationship between the different parts of the<strong>C166</strong>/<strong>ST10</strong> toolchain:<strong>C++</strong> source file.ccC source file.cassembly file.asm<strong>C++</strong> compilerC file.icC compilermacropreprocessorassembly fileinput object files.srclibrary files .libassemblerrecompilationrelocatable objectmodule .obj<strong>C++</strong> prelinkerobject fileC compilergenerated C file.c<strong>C++</strong> muncherlinker object.lnolinker.srcgenerate terminationand initialization codeOVERVIEWassemblerobject file.objcontrol programFigure 1−1: Development flowlinkerlocatorabsolute objectfile .out


Overview1−51.2.1 THE PRELINKER PHASEThe <strong>C++</strong> compiler provides a complete prototype implementation of anautomatic instantiation mechanism. The automatic instantiation mechanismis a "linker feedback" mechanism. It works by providing additionalinformation in the object file that is used by a "prelinker" to determinewhich template entities require instantiation so that the program can belinked successfully. Unlike most aspects of the <strong>C++</strong> compiler the automaticinstantiation mechanism is, by its nature, dependent on certain operatingsystem and object file format properties. In particular, the prelinker is aseparate program that accesses information about the symbols defined inobject files.At the end of each compilation, the <strong>C++</strong> compiler determines whether anytemplate entities were referenced in the translation unit. If so, an"instantiation information" file is created, referred to for convenience as a.ii file. If no template entities were referenced in the translation unit, the.ii file will not be created and any existing file will be removed. If anerror occurs during compilation, the state of the .ii file is unchanged.Once a complete set of object files has been generated, including theappropriate flags, the prelinker is invoked to determine whether any newinstantiations are required or if any existing instantiations are no longerrequired. The command line arguments to the prelinker include a list ofinput files to be analyzed. The input files are the object files and librariesthat constitute the application. The prelinker begins by looking forinstantiation information files for each of the object files. If no instantiationinformation files are present, the prelinker concludes that no further actionis required.If there are instantiation information files, the prelinker reads the currentinstantiation list from each information file. The instantiation list containsthe list of instantiations assigned to a given source file by a previousinvocation of the prelinker. The prelinker produces a list of the globalsymbols that are referenced or defined by each of the input files. Theprelinker then simulates a link operation to determine which symbols mustbe defined for the application to link successfully.••••••••


1−6Chapter 1When the link simulation has been completed, the prelinker processeseach input file to determine whether any new instantiations should beassigned to the input file or if any existing instantiations should beremoved. The prelinker goes through the current instantiation list from theinstantiation information file to determine whether any of the existinginstantiations are no longer needed. An instantiation may be no longerneeded because the template entity is no longer referenced by theprogram or because a user supplied specialization has been provided. Ifthe instantiation is no longer needed, it is removed from the list (internally;the file will be updated later) and the file is flagged as requiringrecompilation.The prelinker then examines any symbols referenced by the input file. Theresponsibility for generating an instantiation of a given entity that has notalready been defined is assigned to the first file that is capable ofgenerating that instantiation.Once all of the assignments have been updated, the prelinker once againgoes through the list of object files. For each, if the correspondinginstantiation information file must be updated, the new file is written. Onlysource files whose corresponding .ii file has been modified will berecompiled.At this point each .ii file contains the information needed to recompilethe source file and a list of instantiations assigned to the source file, in theform of mangled function and static data member names.If an error occurs during a recompilation, the prelinker exits withoutupdating the remaining information files and without attempting anyadditional compilations.OVERVIEWIf all recompilations complete without error, the prelink process isrepeated, since an instantiation can produce the demand for anotherinstantiation. This prelink cycle (finding uninstantiated templates, updatingthe appropriate .ii files, and dispatching recompilations) continues untilno further recompilations are required.When the prelinker is finished, the linker is invoked. Note that simplybecause the prelinker completes successfully does not assure that thelinker will not detect errors. Unresolvable template references and otherlinker errors will not be diagnosed by the prelinker.


Overview1−71.2.2 THE MUNCHER PHASEThe <strong>C++</strong> muncher implements global initialization and termination code.The muncher accepts the output of the linker as its input file. It generatesa C program that defines a data structure containing a list of pointers tothe initialization and termination routines. This generated program is thencompiled and linked in with the executable. The data structure isconsulted at run−time by startup code invoked from _main, and theroutines on the list are invoked at the appropriate times.••••••••


1−8Chapter 11.3 ENVIRONMENT VARIABLESThis section contains an overview of the environment variables used bythe <strong>C166</strong>/<strong>ST10</strong> toolchain.OVERVIEWEnvironment VariableA166INC<strong>C166</strong>INCC<strong>C166</strong>BINC<strong>C166</strong>OPTCP166INCLINK166LOCATE166M166INCLM_LICENSE_FILETASKING_LIC_WAITPATHTMPDIRTable 1−1: Environment variablesDescriptionSpecifies an alternative path for STDNAMES filesfor the assembler a166.Specifies an alternative path for #include files for theC compiler c166.When this variable is set, the control programcc166, prepends the directory specified by thisvariable to the names of the tools invoked.Specifies extra options and/or arguments to eachinvocation of cc166. The control program processesthe arguments from this variable before thecommand line arguments.Specifies an alternative path for #include files for the<strong>C++</strong> compiler cp166.Specifies extra options and/or arguments to eachinvocation of the link stage of l166.Specifies extra options and/or arguments to eachinvocation of the locate stage of l166.Specifies an alternative path for include files for themacro preprocessor m166.With this variable you specify the location of thelicense data file. You only need to specify thisvariable if your host uses the FLEXlm licencemanager.If you set this variable, the tool will wait for a licenseto become available, if all licenses are taken. If youhave not set this variable, the tool aborts with anerror message.With this variable you specify the directory in whichthe executables reside (default: product\bin).This allows you to call the executables when youare not in the bin directory.With this variable you specify the location whereprograms can create temporary files.


Overview1−91.4 FILE EXTENSIONSFor compatibility with future TASKING Cross−Software the followingextensions are suggested:Source files:.cc.cxx.cpp<strong>C++</strong> source file, input for <strong>C++</strong> compiler<strong>C++</strong> source file, input for <strong>C++</strong> compiler<strong>C++</strong> source file, input for <strong>C++</strong> compiler.c C source file, input for C compiler (or for <strong>C++</strong> compiler ifyou use the −c++ option of the control program).asmhand−written assembly source file, input for the assemblerGenerated source files:.ic temporary C source file generated by the <strong>C++</strong> compiler, inputfor the C compiler.srcObject files:.obj.lno.lib.out.abs.hexassembly source file generated by the C compiler, input forthe assemblerrelocatable IEEE−695 object file generated by the assembler,input for the linkerlinked object moduleobject library fileabsolute locator output fileabsolute IEEE−695 object fileabsolute Intel Hex object file••••••••


1−10Chapter 1List files:.mpl.mpe.lst.lnl.mapmacro preprocessor list filemacro preprocessor error list fileassembler list filelinker map filelocator map fileOVERVIEW


CHAPTERLANGUAGEIMPLEMENTATION2


LANGUAGE2−2Chapter 2CHAPTER2


Language Implementation2−32.1 INTRODUCTIONThe TASKING <strong>C++</strong> compiler (cp166) offers a new approach to high−levellanguage programming for the <strong>C166</strong>/<strong>ST10</strong> family. The <strong>C++</strong> compileraccepts the <strong>C++</strong> language as defined by the ISO/IEC 14882:1998 standard,with the exceptions listed in section 2.4. It also accepts the languageextensions of the C compiler.This chapter describes the <strong>C++</strong> language extensions and some specificfeatures.2.2 <strong>C++</strong> LIBRARYThe TASKING <strong>C++</strong> compiler supports the STLport <strong>C++</strong> libraries. STLport isa multiplatform ANSI <strong>C++</strong> Standard Library implementation. It is a free,open−source product, wich is delivered with the TASKING <strong>C++</strong> compiler.The library supports standard templates and I/O streams.The include files for the STLport <strong>C++</strong> libraries are present in directoryinclude.stl relative to the product installation directory.You can find more information and documentation on the STLport libraryon the following site:http://www.stlport.org/doc/index.htmlAlso read the license agreement on:http://www.stlport.org/doc/license.htmlThis license agreement is applicable to the <strong>C++</strong> library only. All otherproduct components fall under the TASKING license agreement.For an STL Programmer’s Guide you can see:http://www.sgi.com/tech/stl/index.html••••••••


2−4Chapter 2The following <strong>C++</strong> libraries are delivered with the product:Library to linkcp166t.libcp166s.libcp166m.libcp166l.libcp166h.libcp166tx.libcp166sx.libcp166mx.libcp166lx.libcp166hx.libstl166s.libstl166l.libstl166h.libstl166sx.libstl166lx.libstl166hx.libstlo166s.libstlo166l.libstlo166h.libstlo166sx.libstlo166lx.libstlo166hx.libDescription<strong>C++</strong> library for each memory model (tiny, small, medium,large, huge)<strong>C++</strong> library with exception handlingSTLport library (small, large or huge)STLport library with exception handlingOptional part of STLport library (small, large or huge).I/O streams, monetary, locale and number punctuationsupport.Optional part of STLport library with exception handlingThese <strong>C++</strong> libraries are not delivered ’ready−to−use’ for the User StackModel variant (see also the C Cross−<strong>Compiler</strong> User’s <strong>Manual</strong>, Chapter 6,Libraries). But makefiles are included to build these libraries.LANGUAGETo build an STLport library (User Stack Model variant)1. Change to the directory installdir\lib\src.stl\uext[2][p]\stl[o]166?[x], depending on the library set used by your project.2. Run the makefile by executing installdir\bin\mk166.exe withoutarguments.3. Copy the generated <strong>C++</strong> library stl[o]166?[x].lib to thecorresponding directory installdir\lib\uext[2][p].where,installdirthe installation directory of the product


Language Implementation2−5? represents the memory model (t=tiny, s=small, m=medium,l=large, h=huge)[o]optional part of STLport library[2] extended XC16x/Super10 architecture[p][x]protected libraries for CPU functional problemsSTLport library with exception handling2.3 <strong>C++</strong> LANGUAGE EXTENSION KEYWORDSThe <strong>C++</strong> compiler supports the same language extension keywords as theC compiler. These language extensions are enabled by default(−−embedded), but you can disable them by specifying the−−no−embedded command line option. When −A is used, the extensionswill be disabled.The following language extensions are supported:_bitYou can use data type _bit for the type definition of scalars and for thereturn type of functions._bitwordYou can declare word variables in the bit−addressable area as fp. You canaccess individual bits using the intrinsic functions _getbit() and_putbit()._sfrbit / _esfrbitData types for the declaration of specific, absolute bits in special functionregisters or special absolute bits in the SFR address space._sfr / _esfrData types for the declaration of Special Function Registers.••••••••


2−6Chapter 2_xsfrData types for the declaration of Special Function Registers not residing inSFR memory but do reside in internal RAM. An example of these SFRs arePEC source and destination pointers. The compiler will use a ’mem’addressing mode for this data type whereas for an object of type _sfr a’reg’ or ’mem’ addressing mode may be used.These SFRs are not bitaddressable._atYou can specify a variable to be at an absolute address._atbitYou can specify a variable to be at a bit offset within a _bitword orbitaddressable _sfr variable._inlineUsed for defining inline functions._usm / _nousmWith these function qualifiers you can force that a function is called usingthe user stack model calling convention or using the generic CALL/RETcalling convention._bitaYou can tell the <strong>C++</strong> compiler that a struct must be located inbitaddressable memory by using the _bita memory qualifier.LANGUAGEmemory−specific pointerscp166 allows you to define pointers which point to a specific targetmemory. These types of pointers are very efficient and require only 2 or 4bytes memory space.special typesApart from a memory category (extern, static, ...) you can specify a storagetype in each declaration. This way you obtain a memorymodel−independent addressing of variables in several address ranges ofthe <strong>C166</strong>/<strong>ST10</strong> (_near, _xnear, _far, _huge, _shuge, _system,_iram).


Language Implementation2−7interrupt functionsYou can specify interrupt functions directly through interrupt vectors in the<strong>C++</strong> language (_interrupt keyword). You may also specify the registerbank to be used (_using keyword).intrinsic functionsA number of pre−declared functions can be used to generate inlineassembly code at the location of the intrinsic (built−in) function call. Thisavoids the overhead which is normally used to do parameter passing andcontext saving before executing the called function.pragmasThe <strong>C++</strong> compiler supports the same pragmas as the C compiler. Pragmasgive directions to the code generator of the compiler.All of the language extensions mentioned above are described in detail inthe C Cross−<strong>Compiler</strong> User’s <strong>Manual</strong>.2.4 <strong>C++</strong> DIALECT ACCEPTEDThe <strong>C++</strong> compiler accepts the <strong>C++</strong> language as defined by the ISO/IEC14882:1998 standard, with the exceptions listed below.The <strong>C++</strong> compiler also has a cfront compatibility mode, which duplicates anumber of features and bugs of cfront 2.1 and 3.0.x. Completecompatibility is not guaranteed or intended; the mode is there to allowprogrammers who have unwittingly used cfront features to continue tocompile their existing code. In particular, if a program gets an error whencompiled by cfront, the <strong>C++</strong> compiler may produce a different error or noerror at all.Command line options are also available to enable and disableanachronisms and strict standard−conformance checking.••••••••


2−8Chapter 22.4.1 NEW LANGUAGE FEATURES ACCEPTEDThe following features not in traditional <strong>C++</strong> (the <strong>C++</strong> language of "TheAnnotated <strong>C++</strong> Reference <strong>Manual</strong>" by Ellis and Stroustrup (ARM)) but inthe standard are implemented:LANGUAGE• The dependent statement of an if, while, do−while, or for isconsidered to be a scope, and the restriction on having such adependent statement be a declaration is removed.• The expression tested in an if, while, do−while, or for, as thefirst operand of a "?" operator, or as an operand of the "&&", ":", or"!"operators may have a pointer−to−member type or a class typethat can be converted to a pointer−to−member type in addition tothe scalar cases permitted by the ARM.• Qualified names are allowed in elaborated type specifiers.• A global−scope qualifier is allowed in member references of theform x.::A::B and p−>::A::B.• The precedence of the third operand of the "?" operator is changed.• If control reaches the end of the main() routine, and main() hasan integral return type, it is treated as if a return 0; statementwere executed.• Pointers to arrays with unknown bounds as parameter types arediagnosed as errors.• A functional−notation cast of the form A() can be used even if A isa class without a (nontrivial) constructor. The temporary createdgets the same default initialization to zero as a static object of theclass type.• A cast can be used to select one out of a set of overloadedfunctions when taking the address of a function.• Template friend declarations and definitions are permitted in classdefinitions and class template definitions.• Type template parameters are permitted to have default arguments.• Function templates may have nontype template parameters.• A reference to const volatile cannot be bound to an rvalue.• Qualification conversions, such as conversion from T**to T const * const * are allowed.• Digraphs are recognized.• Operator keywords (e.g., not, and, bitand, etc.) are recognized.• Static data member declarations can be used to declare memberconstants.


Language Implementation2−9• wchar_t is recognized as a keyword and a distinct type.• bool is recognized.• RTTI (run−time type identification), including dynamic_cast andthe typeid operator, is implemented.• Declarations in tested conditions (in if, switch, for, and whilestatements) are supported.• Array new and delete are implemented.• New−style casts (static_cast, reinterpret_cast, andconst_cast) are implemented.• Definition of a nested class outside its enclosing class is allowed.• mutable is accepted on non−static data member declarations.• Namespaces are implemented, including using declarations anddirectives. Access declarations are broadened to match thecorresponding using declarations.• Explicit instantiation of templates is implemented.• The typename keyword is recognized.• explicit is accepted to declare non−converting constructors.• The scope of a variable declared in the for−init−statement of afor loop is the scope of the loop (not the surrounding scope).• Member templates are implemented.• The new specialization syntax (using template ") isimplemented.• Cv−qualifiers are retained on rvalues (in particular, on functionreturn values).• The distinction between trivial and nontrivial constructors has beenimplemented, as has the distinction between PODs and non−PODswith trivial constructors.• The linkage specification is treated as part of the function type(affecting function overloading and implicit conversions).• extern inline functions are supported, and the default linkagefor inline functions is external.• A typedef name may be used in an explicit destructor call.• Placement delete is implemented.• An array allocated via a placement new can be deallocated viadelete.• Covariant return types on overriding virtual functions are supported.• enum types are considered to be non−integral types.••••••••


2−10Chapter 2LANGUAGE• Partial specialization of class templates is implemented.• Partial ordering of function templates is implemented.• Function declarations that match a function template are regardedas independent functions, not as guiding declarations" that areinstances of the template.• It is possible to overload operators using functions that take enumtypes and no class types.• Explicit specification of function template arguments is supported.• Unnamed template parameters are supported.• The new lookup rules for member references of the form x.A::Band p−>A::B are supported.• The notation :: template (and −>template, etc.) is supported.• In a reference of the form f()−>g(), with g a static memberfunction, f() is evaluated. The ARM specifies that the left operandis not evaluated in such cases.• enum types can contain values larger than can be contained in anint.• Default arguments of function templates and member functions ofclass templates are instantiated only when the default argument isused in a call.• String literals and wide string literals have const type.• Class name injection is implemented.• Argument−dependent (Koenig) lookup of function names isimplemented.• Class and function names declared only in unqualified frienddeclarations are not visible except for functions found byargument−dependent lookup.• A void expression can be specified on a return statement in a voidfunction.• Function−try−blocks, i.e., try−blocks that are the top−levelstatements of functions, constructors, or destructors, areimplemented.• Universal character set escapes (e.g., \uabcd) are implemented.• On a call in which the expression to the left of the openingparenthesis has class type, overload resolution looks for conversionfunctions that can convert the class object to pointer−to−functiontypes, and each such pointed−to "surrogate function" type isevaluated alongside any other candidate functions.


Language Implementation2−11• Template template parameters are implemented.2.4.2 NEW LANGUAGE FEATURES NOT ACCEPTEDThe following features of the <strong>C++</strong> standard are not implemented yet:• Two−phase name binding in templates, as described in [temp.res]and [temp.dep] of the standard, is not implemented.• The export keyword for templates is not implemented.• A partial specialization of a class member template cannot be addedoutside of the class definition.2.4.3 ANACHRONISMS ACCEPTEDThe following anachronisms are accepted when anachronisms are enabled(with −−anachronisms):• overload is allowed in function declarations. It is accepted andignored.• Definitions are not required for static data members that can beinitialized using default initialization. The anachronism does notapply to static data members of template classes; they must alwaysbe defined.• The number of elements in an array may be specified in an arraydelete operation. The value is ignored.• A single operator++() and operator−−() function can be usedto overload both prefix and postfix operations.• The base class name may be omitted in a base class initializer ifthere is only one immediate base class.• Assignment to this in constructors and destructors is allowed. Thisis allowed only if anachronisms are enabled and the "assignment tothis" configuration parameter is enabled.• A bound function pointer (a pointer to a member function for agiven object) can be cast to a pointer to a function.• A nested class name may be used as a non−nested class nameprovided no other class of that name has been declared. Theanachronism is not applied to template classes.• A reference to a non−const type may be initialized from a value of adifferent type. A temporary is created, it is initialized from the(converted) initial value, and the reference is set to the temporary.••••••••


2−12Chapter 2• A reference to a non−const class type may be initialized from anrvalue of the class type or a derived class thereof. No (additional)temporary is used.• A function with old−style parameter declarations is allowed and mayparticipate in function overloading as though it were prototyped.Default argument promotion is not applied to parameter types ofsuch functions when the check for compatibility is done, so that thefollowing declares the overloading of two functions named f:int f(int);int f(x) char x; { return x; }Note that in C this code is legal but has a different meaning: atentative declaration of f is followed by its definition.• When −−nonconst−ref−anachronism is enabled, a reference to anon−const class can be bound to a class rvalue of the same type ora derived type thereof.struct A {A(int);A operator=(A&);A operator+(const A&);};main () {A b(1);b = A(1) + A(2); // Allowed as anachronism}2.4.4 EXTENSIONS ACCEPTED IN NORMAL <strong>C++</strong> MODELANGUAGEThe following extensions are accepted in all modes (except when strictANSI violations are diagnosed as errors):• A friend declaration for a class may omit the class keyword:class A {friend B; // Should be "friend class B"};• Constants of scalar type may be defined within classes:class A {const int size = 10;int a[size];};


Language Implementation2−13• In the declaration of a class member, a qualified name may be used:struct A {int A::f(); // Should be int f();};• The preprocessing symbol c_plusplus is defined in addition tothe standard __cplusplus.• A pointer to a constant type can be deleted.• An assignment operator declared in a derived class with a parametertype matching one of its base classes is treated as a defaultassignment operator, that is, such a declaration blocks the implicitgeneration of a copy assignment operator. (This is cfront behaviorthat is known to be relied upon in at least one widely used library.)Here is an example:struct A { };struct B : public A {B& operator=(A&);};By default, as well as in cfront−compatibility mode, there will be noimplicit declaration of B::operator=(const B&), whereas instrict−ANSI mode B::operator=(A&) is not a copy assignmentoperator and B::operator=(const B&) is implicitly declared.• Implicit type conversion between a pointer to an extern "C"function and a pointer to an extern "<strong>C++</strong>" function is permitted.Here’s an example:extern "C" void f(); // f’s type has extern "C" linkagevoid (*pf)() // pf points to an extern "<strong>C++</strong>" function= &f; // error unless implicit conversion is// allowedThis extension is allowed in environments where C and <strong>C++</strong>functions share the same calling conventions. It is enabled bydefault; it can also be enabled in cfront−compatibility mode or withoption −−implicit−extern−c−type−conversion. It is disabled instrict−ANSI mode.••••••••


2−14Chapter 2• A "?" operator whose second and third operands are string literalsor wide string literals can be implicitly converted to "char *" or"wchar_t *". (Recall that in <strong>C++</strong> string literals are const. There isa deprecated implicit conversion that allows conversion of a stringliteral to "char *", dropping the const. That conversion, however,applies only to simple string literals. Allowing it for the result of a"?" operation is an extension.)char *p = x ? "abc" : "def";• Except in strict−ANSI mode, default arguments may be specified forfunction parameters other than those of a top−level functiondeclaration (e.g., they are accepted on typedef declarations andon pointer−to−function and pointer−to−member−functiondeclarations).2.4.5 EXTENSIONS ACCEPTED IN CFRONT 2.1COMPATIBILITY MODEThe following extensions are accepted in cfront 2.1 compatibility mode inaddition to the extensions listed in the 2.1/3.0 section following (i.e., theseare things that were corrected in the 3.0 release of cfront):LANGUAGE• The dependent statement of an if, while, do−while, or for isnot considered to define a scope. The dependent statement may notbe a declaration. Any objects constructed within the dependentstatement are destroyed at exit from the dependent statement.• Implicit conversion from integral types to enumeration types isallowed.• A non−const member function may be called for a const object.A warning is issued.• A const void * value may be implicitly converted to a void *value, e.g., when passed as an argument.• When, in determining the level of argument match for overloading,a reference parameter is initialized from an argument that requires anon−class standard conversion, the conversion counts as auser−defined conversion.• When a built−in operator is considered alongside overloadedoperators in overload resolution, the match of an operand of abuilt−in type against the built−in type required by the built−inoperator is considered a standard conversion in all cases (e.g., evenwhen the type is exactly right without conversion).


Language Implementation2−15• A reference to a non−const type may be initialized from a valuethat is a const−qualified version of the same type, but only if thevalue is the result of selecting a member from a const class objector a pointer to such an object.• The cfront 2.1 "transitional model" for nested type support issimulated. In the transitional model a nested type is promoted tothe file scope unless a type of the same name already exists at thefile scope. It is an error to have two nested classes of the samename that need to be promoted to file scope or to define a type atfile scope after the declaration of a nested class of the same name.This "feature" actually restricts the source language accepted by thecompiler. This is necessary because of the effect this feature has onthe name mangling of functions that use nested types in theirsignature. This feature does not apply to template classes.• A cast to an array type is allowed; it is treated like a cast to apointer to the array element type. A warning is issued.• When an array is selected from a class, the type qualifiers on theclass object (if any) are not preserved in the selected array. (In thenormal mode, any type qualifiers on the object are preserved in theelement type of the resultant array.)• An identifier in a function is allowed to have the same name as aparameter of the function. A warning is issued.• An expression of type void may be supplied on the returnstatement in a function with a void return type. A warning is issued.• Cfront has a bug that causes a global identifier to be found when amember of a class or one of its base classes should actually befound. This bug is emulated in cfront compatibility mode. Awarning is issued when, because of this feature, a nonstandardlookup is performed. The following conditions must be satisfied forthe nonstandard lookup to be performed:− A member in a base class must have the same name as anidentifier at the global scope. The member may be a function,static data member, or non−static data member. Member typenames do not apply because a nested type will be promoted tothe global scope by cfront which disallows a later declaration ofa type with the same name at the global scope.− The declaration of the global scope name must occur betweenthe declaration of the derived class and the declaration of anout−of−line constructor or destructor. The global scope namemust be a type name.••••••••


2−16Chapter 2−No other member function definition, even one for an unrelatedclass, may appear between the destructor and the offendingreference. This has the effect that the nonstandard lookupapplies to only one class at any given point in time. Forexample:struct B {void func(const char*);};struct D : public B {public:D();void Init(const char* );};struct func {func( const char* msg);};D::D()void D::Init(const char* t){//Should call B::func −− calls func::func instead.new func(t);}LANGUAGEThe global scope name must be present in a base class(B::func in this example) for the nonstandard lookup to occur.Even if the derived class were to have a member named func, itis still the presence of B::func that determines how the lookupwill be performed.• A parameter of type "const void *" is allowed on operatordelete; it is treated as equivalent to "void *".• A period (".") may be used for qualification where "::" should beused. Only "::" may be used as a global qualifier. Except for theglobal qualifier, the two kinds of qualifier operators may not bemixed in a given name (i.e., you may say A::B::C or A.B.C butnot A::B.C or A.B::C). A period may not be used in a vacuousdestructor reference nor in a qualifier that follows a templatereference such as A::B.• Cfront 2.1 does not correctly look up names in friend functions thatare inside class definitions. In this example function f should referto the functions and variables (e.g., f1 and a1) from the classdeclaration. Instead, the global definitions are used.


Language Implementation2−17int a1;int e1;void f1();class A {int a1;void f1();friend void f(){int i1 = a1; // cfront uses global a1f1(); // cfront uses global f1}};Only the innermost class scope is (incorrectly) skipped by cfront asillustrated in the following example.int a1;int b1;struct A {static int a1;class B {static int b1;friend void f(){int i1 = a1; // cfront uses A::a1int j1 = b1; // cfront uses global b1}};};• operator= may be declared as a nonmember function. (This isflagged as an anachronism by cfront 2.1)• A type qualifier is allowed (but ignored) on the declaration of aconstructor or destructor. For example:class A {A() const; // No error in cfront 2.1 mode};••••••••


2−18Chapter 22.4.6 EXTENSIONS ACCEPTED IN CFRONT 2.1 AND 3.0COMPATIBILITY MODEThe following extensions are accepted in both cfront 2.1 and cfront 3.0compatibility mode (i.e., these are features or problems that exist in bothcfront 2.1 and 3.0):• Type qualifiers on the this parameter may to be dropped incontexts such as this example:struct A {void f() const;};void (A::*fp)() = &A::f;This is actually a safe operation. A pointer to a const function maybe put into a pointer to non−const, because a call using thepointer is permitted to modify the object and the function pointedto will actually not modify the object. The opposite assignmentwould not be safe.• Conversion operators specifying conversion to void are allowed.• A nonstandard friend declaration may introduce a new type. Afriend declaration that omits the elaborated type specifier is allowedin default mode, but in cfront mode the declaration is also allowedto introduce a new type name.struct A {friend B;};LANGUAGE• The third operand of the ? operator is a conditional expressioninstead of an assignment expression as it is in the modern language.• A reference to a pointer type may be initialized from a pointer valuewithout use of a temporary even when the reference pointer typehas additional type qualifiers above those present in the pointervalue. For example,int *p;const int *&r = p; // No temporary used• A reference may be initialized with a null.• Because cfront does not check the accessibility of types, accesserrors for types are issued as warnings instead of errors.


Language Implementation2−19• When matching arguments of an overloaded function, a constvariable with value zero is not considered to be a null pointerconstant. In general, in overload resolution a null pointer constantmust be spelled "0" to be considered a null pointer constant (e.g.,’\0’ is not considered a null pointer constant).• Inside the definition of a class type, the qualifier in the declaratorfor a member declaration is dropped if that qualifier names the classbeing defined.struct S {void S::f();};• An alternate form of declaring pointer−to−member−functionvariables is supported, for example:struct A {void f(int);static void sf(int);typedef void A::T3(int); // nonstd typedef decltypedef void T2(int); // std typedef};typedef void A::T(int); // nonstd typedef declT* pmf = &A::f; // nonstd ptr−to−member declA::T2* pf = A::sf; // std ptr to static mem declA::T3* pmf2 = &A::f; // nonstd ptr−to−member declwhere T is construed to name a routine type for a non−staticmember function of class A that takes an int argument and returnsvoid; the use of such types is restricted to nonstandardpointer−to−member declarations. The declarations of T and pmf incombination are equivalent to a single standard pointer−to−memberdeclaration:void (A::* pmf)(int) = &A::f;A nonstandard pointer−to−member declaration that appears outsideof a class declaration, such as the declaration of T, is normallyinvalid and would cause an error to be issued. However, fordeclarations that appear within a class declaration, such as A::T3,this feature changes the meaning of a valid declaration. cfrontversion 2.1 accepts declarations, such as T, even when A is anincomplete type; so this case is also excepted.• Protected member access checking is not done when the address ofa protected member is taken. For example:••••••••


2−20Chapter 2class B { protected: int i; };class D : public B { void mf(); };void D::mf() {int B::* pmi1 = &B::i; // error, OK in cfront modeint D::* pmi2 = &D::i; // OK}Protected member access checking for other operations (i.e., everythingexcept taking a pointer−to−member address) is done in the normalmanner.• The destructor of a derived class may implicitly call the privatedestructor of a base class. In default mode this is an error but incfront mode it is reduced to a warning. For example:class A {~A();};class B : public A {~B();};B::~B(){} // Error except in cfront mode• When disambiguation requires deciding whether something is aparameter declaration or an argument expression, the patterntype−name−or−keyword(identifier...) is treated as an argument. Forexample:class A { A(); };double d;A x(int(d));A(x2);LANGUAGEBy default int(d) is interpreted as a parameter declaration (withredundant parentheses), and so x is a function; but incfront−compatibility mode int(d) is an argument and x is avariable.The declaration A(x2); is also misinterpreted by cfront. It shouldbe interpreted as the declaration of an object named x2, but incfront mode is interpreted as a function style cast of x2 to the typeA.Similarly, the declarationint xyz(int());


Language Implementation2−21declares a function named xzy, that takes a parameter of type"function taking no arguments and returning an int". In cfrontmode this is interpreted as a declaration of an object that isinitialized with the value int() (which evaluates to zero).• A named bit−field may have a size of zero. The declaration istreated as though no name had been declared.• Plain bit fields (i.e., bit fields declared with a type of int) arealways unsigned.• The name given in an elaborated type specifier is permitted to be atypedef name that is the synonym for a class name, e.g.,typedef class A T;class T *pa;mode// No error in cfront• No warning is issued on duplicate size and sign specifiers.short short int i; // No warning in cfront mode• Virtual function table pointer update code is not generated indestructors for base classes of classes without virtual functions, evenif the base class virtual functions might be overridden in afurther−derived class. For example:struct A {virtual void f() {}A() {}~A() {}};struct B : public A {B() {}~B() {f();}};struct C : public B {void f() {}} c;// Should call A::f according to// ARM 12.7In cfront compatibility mode, B::~B calls C::f.• An extra comma is allowed after the last argument in an argumentlist, as for example inf(1, 2, );• A constant pointer−to−member−function may be cast to apointer−to−function. A warning is issued.••••••••


2−22Chapter 2LANGUAGEstruct A {int f();};main () {int (*p)();p = (int (*)())A::f; // Okay, with warning}• Arguments of class types that allow bitwise copy construction butalso have destructors are passed by value (i.e., like C structures),and the destructor is not called on the "copy". In normal mode, theclass object is copied into a temporary, the address of the temporaryis passed as the argument, and the destructor is called on thetemporary after the call returns. Note that because the argument ispassed differently (by value instead of by address), code like thiscompiled in cfront mode is not calling−sequence compatible withthe same code compiled in normal mode. In practice, this is notmuch of a problem, since classes that allow bitwise copying usuallydo not have destructors.• A union member may be declared to have the type of a class forwhich you have defined an assignment operator (as long as theclass has no constructor or destructor). A warning is issued.• When an unnamed class appears in a typedef declaration, thetypedef name may appear as the class name in an elaborated typespecifier.typedef struct { int i, j; } S;struct S x; // No error in cfront mode• Two member functions may be declared with the same parametertypes when one is static and the other is non−static with a functionqualifier.class A {void f(int) const;static void f(int); // No error in cfront mode};• The scope of a variable declared in the for−init−statement isthe scope to which the for statement belongs.int f(int i) {for (int j = 0; j < i; ++j) { /* ... */ }return j;// No error in cfront mode}• Function types differing only in that one is declared extern "C"and the other extern "<strong>C++</strong>" can be treated as identical:


Language Implementation2−23typedef void (*PF)();extern "C" typedef void (*PCF)();void f(PF);void f(PCF);PF and PCF are considered identical and void f(PCF) is treatedas a compatible redeclaration of f. (By contrast, in standard <strong>C++</strong> PFand PCF are different and incompatible types PF is a pointer toan extern "<strong>C++</strong>" function whereas PCF is a pointer to an extern"C" function and the two declarations of f create an overloadset.)• Functions declared inline have internal linkage.• enum types are regarded as integral types.• An uninitialized const object of non−POD class type is allowedeven if its default constructor is implicitly declared:struct A { virtual void f(); int i; };const A a;• A function parameter type is allowed to involve a pointer orreference to array of unknown bounds.• If the user declares an operator= function in a class, but not onethat can serve as the default operator=, and bitwise assignmentcould be done on the class, a default operator= is not generated;only the user−written operator= functions are considered forassignments (and therefore bitwise assignment is not done).• A member function declaration whose return type is omitted (andthus implicitly int) and whose name is found to be that of a type isaccepted if it takes no parameters:typedef int I;struct S {I(); // Accepted in Cfront mode (declares "int S::I()")I(int); // Not accepted};••••••••


2−24Chapter 22.5 NAMESPACE SUPPORTNamespaces are enabled by default except in the cfront modes. You canuse the command−line options −−namespaces and −−no−namespacesto enable or disable the features.Name lookup during template instantiations now does something thatapproximates the two−phase lookup rule of the standard. When a name islooked up as part of a template instantiation but is not found in the localcontext of the instantiation, it is looked up in a synthesized instantiationcontext. The <strong>C++</strong> compiler follows the new instantiation lookup rules fornamespaces as closely as possible in the absence of a completeimplementation of the new template name binding rules. Here is anexample:namespace N {int g(int);int x = 0;template struct A {T f(T t) { return g(t); }T f() { return x; }};}LANGUAGEnamespace M {int x = 99;double g(double);N::A ai;int i = ai.f(0);}int i2 = ai.f();// N::A::f(int) calls// N::g(int)// N::A::f() returns// 0 (= N::x)N::A ad;double d = ad.f(0); // N::A::f(double)// calls M::g(double)double d2 = ad.f(); // N::A::f() also// returns 0 (= N::x)The lookup of names in template instantiations does not conform to therules in the standard in the following respects:• Although only names from the template definition context areconsidered for names that are not functions, the lookup is notlimited to those names visible at the point at which the templatewas defined.


Language Implementation2−25• Functions from the context in which the template was referencedare considered for all function calls in the template. Functions fromthe referencing context should only be visible for dependentfunction calls.The lookup rules for overloaded operators are implemented as specifiedby the standard, which means that the operator functions in the globalscope overload with the operator functions declared extern inside afunction, instead of being hidden by them. The old operator functionlookup rules are used when namespaces are turned off. This means aprogram can have different behavior, depending on whether it is compiledwith namespace support enabled or disabled:struct A { };A operator+(A, double);void f() {A a1;A operator+(A, int);a1 + 1.0; // calls operator+(A, double)// with namespaces enabled but} // otherwise calls operator+(A, int);••••••••


2−26Chapter 22.6 TEMPLATE INSTANTIATIONThe <strong>C++</strong> language includes the concept of templates. A template is adescription of a class or function that is a model for a family of relatedclasses or functions. 1 For example, one can write a template for a Stackclass, and then use a stack of integers, a stack of floats, and a stack ofsome user−defined type. In the source, these might be writtenStack, Stack, and Stack. From a single sourcedescription of the template for a stack, the compiler can createinstantiations of the template for each of the types required.The instantiation of a class template is always done as soon as it is neededin a compilation. However, the instantiations of template functions,member functions of template classes, and static data members of templateclasses (hereafter referred to as template entities) are not necessarily doneimmediately, for several reasons:LANGUAGE• One would like to end up with only one copy of each instantiatedentity across all the object files that make up a program. (This ofcourse applies to entities with external linkage.)• The language allows one to write a specialization of a templateentity, i.e., a specific version to be used in place of a versiongenerated from the template for a specific data type. (One could,for example, write a version of Stack, or of justStack::push, that replaces the template−generated version;often, such a specialization provides a more efficient representationfor a particular data type.) Since the compiler cannot know, whencompiling a reference to a template entity, if a specialization for thatentity will be provided in another compilation, it cannot do theinstantiation automatically in any source file that references it.• The language also dictates that template functions that are notreferenced should not be compiled, that, in fact, such functionsmight contain semantic errors that would prevent them from beingcompiled. Therefore, a reference to a template class should notautomatically instantiate all the member functions of that class.(It should be noted that certain template entities are always instantiatedwhen used, e.g., inline functions.)1 Since templates are descriptions of entities (typically, classes) thatare parameterizable according to the types they operate upon, theyare sometimes called parameterized types.


Language Implementation2−27From these requirements, one can see that if the compiler is responsiblefor doing all the instantiations automatically, it can only do so on aprogram−wide basis. That is, the compiler cannot make decisions aboutinstantiation of template entities until it has seen all the source files thatmake up a complete program.This <strong>C++</strong> compiler provides an instantiation mechanism that doesautomatic instantiation at link time. For cases where you want moreexplicit control over instantiation, the <strong>C++</strong> compiler also providesinstantiation modes and instantiation pragmas, which can be used to exertfine−grained control over the instantiation process.2.6.1 AUTOMATIC INSTANTIATIONThe goal of an automatic instantiation mode is to provide painlessinstantiation. You should be able to compile source files to object code,then link them and run the resulting program, and never have to worryabout how the necessary instantiations get done.In practice, this is hard for a compiler to do, and different compilers usedifferent automatic instantiation schemes with different strengths andweaknesses:• AT&T/USL/Novell’s cfront product saves information about each fileit compiles in a special directory called ptrepository. Itinstantiates nothing during normal compilations. At link time, itlooks for entities that are referenced but not defined, and whosemangled names indicate that they are template entities. For eachsuch entity, it consults the ptrepository information to find thefile containing the source for the entity, and it does a compilation ofthe source to generate an object file containing object code for thatentity. This object code for instantiated objects is then combinedwith the "normal" object code in the link step.••••••••


2−28Chapter 2If you are using cfront you must follow a particular codingconvention: all templates must be declared in .h files, and for eachsuch file there must be a corresponding .cc file containing theassociated definitions. The compiler is never told about the .ccfiles explicitly; one does not, for example, compile them in thenormal way. The link step looks for them when and if it needsthem, and does so by taking the .h filename and replacing itssuffix. 2LANGUAGEThis scheme has the disadvantage that it does a separatecompilation for each instantiated function (or, at best, onecompilation for all the member functions of one class). Even thoughthe function itself is often quite small, it must be compiled alongwith the declarations for the types on which the instantiation isbased, and those declarations can easily run into many thousands oflines. For large systems, these compilations can take a very longtime. The link step tries to be smart about recompiling instantiationsonly when necessary, but because it keeps no fine−graineddependency information, it is often forced to "recompile the world"for a minor change in a .h file. In addition, cfront has no way ofensuring that preprocessing symbols are set correctly when it doesthese instantiation compilations, if preprocessing symbols are setother than on the command line.• Borland’s <strong>C++</strong> compiler instantiates everything referenced in acompilation, then uses a special linker to remove duplicatedefinitions of instantiated functions.If you are using Borland’s compiler you must make sure that everycompilation sees all the source code it needs to instantiate all thetemplate entities referenced in that compilation. That is, one cannotrefer to a template entity in a source file if a definition for that entityis not included by that source file. In practice, this means that eitherall the definition code is put directly in the .h files, or that each .hfile includes an associated .cc (actually, .cpp) file.This scheme is straightforward, and works well for small programs.For large systems, however, it tends to produce very large objectfiles, because each object file must contain object code (andsymbolic debugging information) for each template entity itreferences.2 The actual implementation allows for several different suffixes andprovides a command−line option to change the suffixes sought.


Language Implementation2−29Our approach is a little different. It requires that, for each instantiationrequired, there is some (normal, top−level, explicitly−compiled) source filethat contains the definition of the template entity, a reference that causesthe instantiation, and the declarations of any types required for theinstantiation. 3 This requirement can be met in various ways:• The Borland convention: each .h file that declares a template entityalso contains either the definition of the entity or includes anotherfile containing the definition.• Implicit inclusion: when the compiler sees a template declaration ina .h file and discovers a need to instantiate that entity, it is givenpermission to go off looking for an associated definition file havingthe same base name and a different suffix, and it implicitly includesthat file at the end of the compilation. This method allows mostprograms written using the cfront convention to be compiled withour approach. See the section on implicit inclusion.• The ad hoc approach: you make sure that the files that definetemplate entities also have the definitions of all the available types,and add code or pragmas in those files to request instantiation ofthe entities there.Our compiler’s automatic instantiation method works as follows:1. The first time the source files of a program are compiled, no templateentities are instantiated. However, the generated object files containinformation about things that could have been instantiated in eachcompilation. For any source file that makes use of a template instantiationan associated .ii file is created if one does not already exist (e.g., thecompilation of abc.cc would result in the creation of abc.ii).2. When the object files are linked together, a program called the prelinker,prelk166, is run. It examines the object files, looking for references anddefinitions of template entities, and for the added information aboutentities that could be instantiated.3 Isn’t this always the case? No. Suppose that file A contains adefinition of class X and a reference to Stack::push, and thatfile B contains the definition for the member function push. Therewould be no file containing both the definition of push and thedefinition of X.••••••••


2−30Chapter 23. If the prelinker finds a reference to a template entity for which there is nodefinition anywhere in the set of object files, it looks for a file thatindicates that it could instantiate that template entity. When it finds such afile, it assigns the instantiation to it. The set of instantiations assigned to agiven file is recorded in the associated instantiation request file (with, bydefault, a .ii suffix).4. The prelinker then executes the compiler again to recompile each file forwhich the .ii file was changed. The original compilation command−lineoptions (saved in the template information file) are used for therecompilation.5. When the compiler compiles a file, it reads the .ii file for that file andobeys the instantiation requests therein. It produces a new object filecontaining the requested template entities (and all the other things thatwere already in the object file).6. The prelinker repeats steps 3−5 until there are no more instantiations to beadjusted.7. The object files are linked together.Once the program has been linked correctly, the .ii files contain acomplete set of instantiation assignments. From then on, whenever sourcefiles are recompiled, the compiler will consult the .ii files and do theindicated instantiations as it does the normal compilations. That meansthat, except in cases where the set of required instantiations changes, theprelink step from then on will find that all the necessary instantiations arepresent in the object files and no instantiation assignment adjustmentsneed be done. That’s true even if the entire program is recompiled.LANGUAGEIf you provide a specialization of a template entity somewhere in theprogram, the specialization will be seen as a definition by the prelinker.Since that definition satisfies whatever references there might be to thatentity, the prelinker will see no need to request an instantiation of theentity. If you add a specialization to a program that has previously beencompiled, the prelinker will notice that too and remove the assignment ofthe instantiation from the proper .ii file.The .ii files should not, in general, require any manual intervention. Oneexception: if a definition is changed in such a way that some instantiationno longer compiles (it gets errors), and at the same time a specialization isadded in another file, and the first file is being recompiled before thespecialization file and is getting errors, the .ii file for the file getting theerrors must be deleted manually to allow the prelinker to regenerate it.


Language Implementation2−31If you supplied the −v option to the control program cc166, and theprelinker changes an instantiation assignment, the prelinker will issuemessages like:<strong>C++</strong> prelinker: A::f() assigned to file test.o<strong>C++</strong> prelinker: executing: cc166 −c test.ccThe automatic instantiation scheme can coexist with partial explicit controlof instantiation by you through the use of pragmas or command−linespecification of the instantiation mode. See the following sections.Instantiations are normally generated as part of the object file of thetranslation unit in which the instantiations are performed. But when "oneinstantiation per object" mode is specified, each instantiation is placed inits own object file. One−instantiation−per−object mode is useful whengenerating libraries that need to include copies of the instances referencedfrom the library. If each instance is not placed in its own object file, it maybe impossible to link the library with another library containing some ofthe same instances. Without this feature it is necessary to create eachindividual instantiation object file using the manual instantiationmechanism.The automatic instantiation mode is enabled by default. It can be turnedoff by the command−line option −−no−auto−instantiation. If automaticinstantiation is turned off, the extra information about template entities thatcould be instantiated in a file is not put into the object file.2.6.2 INSTANTIATION MODESNormally, when a file is compiled, no template entities are instantiated(except those assigned to the file by automatic instantiation). The overallinstantiation mode can, however, be changed by a command line option:−−instantiate noneDo not automatically create instantiations of any templateentities. This is the default. It is also the usually appropriatemode when automatic instantiation is done.−−instantiate usedInstantiate those template entities that were used in thecompilation. This will include all static data members forwhich there are template definitions.••••••••


2−32Chapter 2−−instantiate allInstantiate all template entities declared or referenced in thecompilation unit. For each fully instantiated template class, allof its member functions and static data members will beinstantiated whether or not they were used. Non−membertemplate functions will be instantiated even if the onlyreference was a declaration.−−instantiate localSimilar to −−instantiate used except that the functions aregiven internal linkage. This is intended to provide a verysimple mechanism for those getting started with templates.The compiler will instantiate the functions that are used ineach compilation unit as local functions, and the programwill link and run correctly (barring problems due to multiplecopies of local static variables.) However, one may end upwith many copies of the instantiated functions, so this is notsuitable for production use. −−instantiate local can not beused in conjunction with automatic template instantiation. Ifautomatic instantiation −−instantiate local option. Ifautomatic instantiation is not enabled by default, use of−−instantiate local and −−auto−instantiation is an error.In the case where the cc166 command is given a single file to compileand link, e.g.,cc166 test.ccthe compiler knows that all instantiations will have to be done in thesingle source file. Therefore, it uses the −−instantiate used mode andsuppresses automatic instantiation.LANGUAGE2.6.3 INSTANTIATION #PRAGMA DIRECTIVESInstantiation pragmas can be used to control the instantiation of specifictemplate entities or sets of template entities. There are three instantiationpragmas:• The instantiate pragma causes a specified entity to be instantiated.• The do_not_instantiate pragma suppresses the instantiation of aspecified entity. It is typically used to suppress the instantiation ofan entity for which a specific definition will be supplied.


Language Implementation2−33• The can_instantiate pragma indicates that a specified entity can beinstantiated in the current compilation, but need not be; it is used inconjunction with automatic instantiation, to indicate potential sitesfor instantiation if the template entity turns out to be required.The argument to the instantiation pragma may be:a template class namea template class declarationa member function namea static data member namea static data declarationa member function declarationa template function declarationAclass AA::fA::iint A::ivoid A::f(int,char)char* f(int, float)A pragma in which the argument is a template class name (e.g., Aor class A) is equivalent to repeating the pragma for eachmember function and static data member declared in the class. Wheninstantiating an entire class a given member function or static data membermay be excluded using the do_not_instantiate pragma. For example,#pragma instantiate A#pragma do_not_instantiate A::fThe template definition of a template entity must be present in thecompilation for an instantiation to occur. If an instantiation is explicitlyrequested by use of the instantiate pragma and no template definition isavailable or a specific definition is provided, an error is issued.template void f1(T); // No body providedtemplate void g1(T); // No body provided••••••••


LANGUAGE2−34Chapter 2void f1(int) {} // Specific definitionvoid main(){int i;double d;f1(i);f1(d);g1(i);g1(d);}#pragma instantiate void f1(int)#pragma instantiate void g1(int)// error − specific// definition// error − no body// providedf1(double) and g1(double) will not be instantiated (because nobodies were supplied) but no errors will be produced during thecompilation (if no bodies are supplied at link time, a linker error will beproduced).A member function name (e.g., A::f) can only be used as apragma argument if it refers to a single user defined member function (i.e.,not an overloaded function). <strong>Compiler</strong>−generated functions are notconsidered, so a name may refer to a user defined constructor even if acompiler−generated copy constructor of the same name exists. Overloadedmember functions can be instantiated by providing the complete memberfunction declaration, as in#pragma instantiate char* A::f(int, char*)The argument to an instantiation pragma may not be a compiler−generatedfunction, an inline function, or a pure virtual function.


Language Implementation2−352.6.4 IMPLICIT INCLUSIONWhen implicit inclusion is enabled, the <strong>C++</strong> compiler is given permissionto assume that if it needs a definition to instantiate a template entitydeclared in a .h file it can implicitly include the corresponding .cc file toget the source code for the definition. For example, if a template entityABC::f is declared in file xyz.h, and an instantiation of ABC::f isrequired in a compilation but no definition of ABC::f appears in thesource code processed by the compilation, the compiler will look to see ifa file xyz.cc exists, and if so it will process it as if it were included at theend of the main source file.To find the template definition file for a given template entity the <strong>C++</strong>compiler needs to know the full path name of the file in which thetemplate was declared and whether the file was included using the systeminclude syntax (e.g., #include ). This information is notavailable for preprocessed source containing #line directives.Consequently, the <strong>C++</strong> compiler will not attempt implicit inclusion forsource code containing #line directives.By default, the list of definition−file suffixes tried is .cc, .cpp, and .cxx.If −c++ is supplied to the control program cc166, .c is also used as <strong>C++</strong>file.Implicit inclusion works well alongside automatic instantiation, but the twoare independent. They can be enabled or disabled independently, andimplicit inclusion is still useful when automatic instantiation is not done.The implicit inclusion mode can be turned on by the command−lineoption −−implicit−include.Implicit inclusions are only performed during the normal compilation of afile, (i.e., not when doing only preprocessing). A common means ofinvestigating certain kinds of problems is to produce a preprocessedsource file that can be inspected. When using implicit inclusion it issometimes desirable for the preprocessed source file to include anyimplicitly included files. This may be done using the −−no−preproc−onlycommand line option. This causes the preprocessed output to begenerated as part of a normal compilation. When implicit inclusion isbeing used, the implicitly included files will appear as part of thepreprocessed output in the precise location at which they were includedin the compilation.••••••••


2−36Chapter 22.7 PREDEFINED MACROSThe <strong>C++</strong> compiler defines a number of preprocessing macros. Many ofthem are only defined under certain circumstances. This section describesthe macros that are provided and the circumstances under which they aredefined.All C predefined macros are also defined.__STDC____FILE____LINE____TIME____DATE___MODELDefined in ANSI C mode and in <strong>C++</strong> mode. In <strong>C++</strong> mode thevalue may be redefined. Not defined when embedded <strong>C++</strong>is used."current source filename"current source line number (int type)"hh:mm:ss""Mmm dd yyyy"Identifies for which memory model the module is compiled.__cplusplus Defined in <strong>C++</strong> mode.c_plusplusDefined in default <strong>C++</strong> mode, but not in strict mode.__STDC_VERSION__Defined in ANSI C mode with the value 199409L. The nameof this macro, and its value, are specified in NormativeAddendum 1 of the ISO C Standard.LANGUAGE__SIGNED_CHARS__Defined when plain char is signed. This is used in the header file to get the proper definitions ofCHAR_MAX and CHAR_MIN._WCHAR_T Defined in <strong>C++</strong> mode when wchar_t is a keyword._BOOLDefined in <strong>C++</strong> mode when bool is a keyword.__ARRAY_OPERATORSDefined in <strong>C++</strong> mode when array new and delete areenabled.__EXCEPTIONSDefined in <strong>C++</strong> mode when exception handling is enabled.


Language Implementation2−37__RTTIDefined in <strong>C++</strong> mode when RTTI is enabled.__PLACEMENT_DELETEDefined in <strong>C++</strong> mode when placement delete is enabled.__NAMESPACESDefined in <strong>C++</strong> mode when namespaces are supported(−−namespaces).__TSW_RUNTIME_USES_NAMESPACESDefined in <strong>C++</strong> mode when the configuration flagRUNTIME_USES_NAMESPACES is TRUE. The name of thispredefined macro is specified by a configuration flag.__EDG_RUNTIME_USES_NAMESPACES is the default.__TSW_IMPLICIT_USING_STDDefined in <strong>C++</strong> mode when the configuration flagRUNTIME_USES_NAMESPACES is TRUE and when thestandard header files should implicitly do a using−directiveon the std namespace (−−using−std).__TSW_CPP__Always defined.__TSW_CPP_VERSION__Defined to an integral value that represents the versionnumber of the <strong>C++</strong> front end. For example, version 2.43 isrepresented as 243.__embedded_cplusplusDefined as 1 in Embedded <strong>C++</strong> mode.••••••••


2−38Chapter 22.8 PRECOMPILED HEADERSIt is often desirable to avoid recompiling a set of header files, especiallywhen they introduce many lines of code and the primary source files that#include them are relatively small. The <strong>C++</strong> compiler provides amechanism for, in effect, taking a snapshot of the state of the compilationat a particular point and writing it to a disk file before completing thecompilation; then, when recompiling the same source file or compilinganother file with the same set of header files, it can recognize the"snapshot point", verify that the corresponding precompiled header (PCH)file is reusable, and read it back in. Under the right circumstances, this canproduce a dramatic improvement in compilation time; the trade−off is thatPCH files can take a lot of disk space.2.8.1 AUTOMATIC PRECOMPILED HEADERPROCESSINGWhen −−pch appears on the command line, automatic precompiledheader processing is enabled. This means the <strong>C++</strong> compiler willautomatically look for a qualifying precompiled header file to read inand/or will create one for use on a subsequent compilation.The PCH file will contain a snapshot of all the code preceding the "headerstop" point. The header stop point is typically the first token in the primarysource file that does not belong to a preprocessing directive, but it canalso be specified directly by #pragma hdrstop (see below) if that comesfirst. For example:LANGUAGE#include "xxx.h"#include "yyy.h"int i;The header stop point is int (the first non−preprocessor token) and thePCH file will contain a snapshot reflecting the inclusion of xxx.h andyyy.h. If the first non−preprocessor token or the #pragma hdrstopappears within a #if block, the header stop point is the outermostenclosing #if. To illustrate, heres a more complicated example:


Language Implementation2−39#include "xxx.h"#ifndef YYY_H#define YYY_H 1#include "yyy.h"#endif#if TESTint i;#endifHere, the first token that does not belong to a preprocessing directive isagain int, but the header stop point is the start of the #if blockcontaining it. The PCH file will reflect the inclusion of xxx.h andconditionally the definition of YYY_H and inclusion of yyy.h; it will notcontain the state produced by #if TEST.A PCH file will be produced only if the header stop point and the codepreceding it (mainly, the header files themselves) meet certainrequirements:• The header stop point must appear at file scope −− it may not bewithin an unclosed scope established by a header file. For example,a PCH file will not be created in this case:// xxx.hclass A {// xxx.C#include "xxx.h"int i; };• The header stop point may not be inside a declaration startedwithin a header file, nor (in <strong>C++</strong>) may it be part of a declaration listof a linkage specification. For example, in the following case theheader stop point is int, but since it is not the start of a newdeclaration, no PCH file will be created:// yyy.hstatic// yyy.C#include "yyy.h"int i;• Similarly, the header stop point may not be inside a #if block or a#define started within a header file.••••••••


2−40Chapter 2• The processing preceding the header stop must not have producedany errors. (Note: warnings and other diagnostics will not bereproduced when the PCH file is reused.)• No references to predefined macros __DATE__ or __TIME__ mayhave appeared.• No use of the #line preprocessing directive may have appeared.• #pragma no_pch (see below) must not have appeared.• The code preceding the header stop point must have introduced asufficient number of declarations to justify the overhead associatedwith precompiled headers. The minimum number of declarationsrequired is 1.When the host system does not support memory mapping, so thateverything to be saved in the precompiled header file is assigned topreallocated memory (MS−Windows), two additional restrictions apply:• The total memory needed at the header stop point cannot exceedthe size of the block of preallocated memory.• No single program entity saved can exceed 16384, the preallocationunit.When a precompiled header file is produced, it contains, in addition to thesnapshot of the compiler state, some information that can be checked todetermine under what circumstances it can be reused. This includes:LANGUAGE• The compiler version, including the date and time the compiler wasbuilt.• The current directory (i.e., the directory in which the compilation isoccurring).• The command line options.• The initial sequence of preprocessing directives from the primarysource file, including #include directives.• The date and time of the header files specified in #includedirectives.


Language Implementation2−41This information comprises the PCH prefix. The prefix information of agiven source file can be compared to the prefix information of a PCH fileto determine whether the latter is applicable to the current compilation.As an illustration, consider two source files:// a.cc#include "xxx.h"... // Start of code// b.cc#include "xxx.h"... // Start of codeWhen a.cc is compiled with −−pch, a precompiled header file nameda.pch is created. Then, when b.cc is compiled (or when a.cc isrecompiled), the prefix section of a.pch is read in for comparison withthe current source file. If the command line options are identical, if xxx.hhas not been modified, and so forth, then, instead of opening xxx.h andprocessing it line by line, the <strong>C++</strong> compiler reads in the rest of a.pch andthereby establishes the state for the rest of the compilation.It may be that more than one PCH file is applicable to a given compilation.If so, the largest (i.e., the one representing the most preprocessingdirectives from the primary source file) is used. For instance, consider aprimary source file that begins with#include "xxx.h"#include "yyy.h"#include "zzz.h"If there is one PCH file for xxx.h and a second for xxx.h and yyy.h,the latter will be selected (assuming both are applicable to the currentcompilation). Moreover, after the PCH file for the first two headers is readin and the third is compiled, a new PCH file for all three headers may becreated.When a precompiled header file is created, it takes the name of theprimary source file, with the suffix replaced by animplementation−specified suffix (pch by default). Unless −−pch−dir isspecified (see below), it is created in the directory of the primary sourcefile.When a precompiled header file is created or used, a message such as"test.cc": creating precompiled header file "test.pch"••••••••


2−42Chapter 2is issued. The user may suppress the message by using the command−lineoption −−no−pch−messages.When the −−pch−verbose option is used the <strong>C++</strong> compiler will display amessage for each precompiled header file that is considered that cannot beused giving the reason that it cannot be used.In automatic mode (i.e., when −−pch is used) the <strong>C++</strong> compiler will deema precompiled header file obsolete and delete it under the followingcircumstances:• if the precompiled header file is based on at least one out−of−dateheader file but is otherwise applicable for the current compilation;or• if the precompiled header file has the same base name as thesource file being compiled (e.g., xxx.pch and xxx.cc) but is notapplicable for the current compilation (e.g., because of differentcommand−line options).This handles some common cases; other PCH file clean−up must be dealtwith by other means (e.g., by the user).Support for precompiled header processing is not available when multiplesource files are specified in a single compilation: an error will be issuedand the compilation aborted if the command line includes a request forprecompiled header processing and specifies more than one primarysource file.2.8.2 MANUAL PRECOMPILED HEADER PROCESSINGLANGUAGECommand−line option −−create−pch file−name specifies that aprecompiled header file of the specified name should be created.Command−line option −−use−pch file−name specifies that the indicatedprecompiled header file should be used for this compilation; if it is invalid(i.e., if its prefix does not match the prefix for the current primary sourcefile), a warning will be issued and the PCH file will not be used.When either of these options is used in conjunction with −−pch−dir, theindicated file name (which may be a path name) is tacked on to thedirectory name, unless the file name is an absolute path name.


Language Implementation2−43The −−create−pch, −−use−pch, and −−pch options may not be usedtogether. If more than one of these options is specified, only the last onewill apply. Nevertheless, most of the description of automatic PCHprocessing applies to one or the other of these modes −− header stoppoints are determined the same way, PCH file applicability is determinedthe same way, and so forth.2.8.3 OTHER WAYS TO CONTROL PRECOMPILEDHEADERSThere are several ways in which the user can control and/or tune howprecompiled headers are created and used.• #pragma hdrstop may be inserted in the primary source file at apoint prior to the first token that does not belong to a preprocessingdirective. It enables you to specify where the set of header filessubject to precompilation ends. For example,#include "xxx.h"#include "yyy.h"#pragma hdrstop#include "zzz.h"Here, the precompiled header file will include processing state forxxx.h and yyy.h but not zzz.h. (This is useful if the user decidesthat the information added by what follows the #pragma hdrstopdoes not justify the creation of another PCH file.)• #pragma no_pch may be used to suppress precompiled headerprocessing for a given source file.• Command−line option −−pch−dir directory−name is used tospecify the directory in which to search for and/or create a PCH file.Moreover, when the host system does not support memory mapping andpreallocated memory is used instead, then one of the command−lineoptions −−pch, −−create−pch, or −−use−pch, if it appears at all, must bethe first option on the command line.••••••••


2−44Chapter 22.8.4 PERFORMANCE ISSUESThe relative overhead incurred in writing out and reading back in aprecompiled header file is quite small for reasonably large header files.In general, it does not cost much to write a precompiled header file outeven if it does not end up being used, and if it is used it almost alwaysproduces a significant speedup in compilation. The problem is that theprecompiled header files can be quite large (from a minimum of about250K bytes to several megabytes or more), and so one probably does notwant many of them sitting around.Thus, despite the faster recompilations, precompiled header processing isnot likely to be justified for an arbitrary set of files with nonuniform initialsequences of preprocessing directives. Rather, the greatest benefit occurswhen a number of source files can share the same PCH file. The moresharing, the less disk space is consumed. With sharing, the disadvantage oflarge precompiled header files can be minimized, without giving up theadvantage of a significant speedup in compilation times.Consequently, to take full advantage of header file precompilation, usersshould expect to reorder the #include sections of their source filesand/or to group #include directives within a commonly used headerfile.Below is an example of how this can be done. A common idiom is this:#include "comnfile.h"#pragma hdrstop#include ...LANGUAGEwhere comnfile.h pulls in, directly and indirectly, a few dozen headerfiles; the #pragma hdrstop is inserted to get better sharing with fewerPCH files. The PCH file produced for comnfile.h can be a bit over amegabyte in size. Another idiom, used by the source files involved indeclaration processing, is this:#include "comnfile.h"#include "decl_hdrs.h"#pragma hdrstop#include ...


Language Implementation2−45decl_hdrs.h pulls in another dozen header files, and a second,somewhat larger, PCH file is created. In all, the source files of a particularprogram can share just a few precompiled header files. If disk space wereat a premium, you could decide to make comnfile.h pull in all theheader files used −− then, a single PCH file could be used in building theprogram.Different environments and different projects will have different needs, butin general, users should be aware that making the best use of theprecompiled header support will require some experimentation andprobably some minor changes to source code.••••••••


LANGUAGE2−46Chapter 22.9 PROHIBITED <strong>C166</strong> OPTIMIZATIONSThis section describes additional remarks which apply when compiling the<strong>C166</strong>/<strong>ST10</strong> C code generated by cp166 using c166.2.9.1 ’MAIN’ LABELS IN A <strong>C++</strong> APPLICATIONThe symbol ’_main’ is generated by c166 when compiling the main()function coded by the user in the application.The symbol ’__main’ is generated by cp166 when the __main() functionis called. This function is part of the <strong>C++</strong> library and is automatically calledby the main() function for <strong>C++</strong> initialization purposes. The function’___main_called_more_than_once()’ is used to prevent multipleinstantiations of the __main() function, thus preventing multipleinitializations.2.9.2 PROHIBITED <strong>C166</strong> OPTIMIZATIONSThe −Ot optimization cannot be used when compiling the <strong>C166</strong>/<strong>ST10</strong> Ccode generated by cp166.With −Ot, tentative declarations (such as int i;) are turned into definingoccurrences (e.g. int i=0;). This mechanism is used by cp166 and willtherefore generate an error when compiled with c166 using the −Otoption.


CHAPTERCOMPILER USE3


USAGE3−2Chapter 3CHAPTER3


<strong>Compiler</strong> Use3−33.1 INVOCATIONThe invocation syntax of the <strong>C++</strong> compiler is:cp166 [option]... fileWhen you use a UNIX shell (Bourne shell, C−shell), arguments containingspecial characters (such as ’( )’ and ’?’) must be enclosed with " " orescaped. The −? option (in the C−shell) becomes: "−?" or −\?.The <strong>C++</strong> compiler accepts a <strong>C++</strong> source file name and command lineoptions in random order. A <strong>C++</strong> source file must have a .cc, .cxx or.cpp suffix.Command line options may be specified using either single characteroption codes (e.g., −A), or keyword options (e.g., −−strict). If an optionrequires an argument, the argument may immediately follow the optionletter, or may be separated from the option letter by white space. Akeyword option specification consists of two hyphens followed by theoption keyword (e.g., −−strict). Keyword options may be abbreviated byspecifying as many of the leading characters of the option name as areneeded to uniquely identify an option name (for example, the−−wchar_t−keyword option may be abbreviated as −−wc). Note that thisis not supported by the control program! If an option requires anargument, the argument may be separated from the keyword by whitespace, or the keyword may be immediately followed by =option. Whenthe second form is used there may not be any white space on either sideof the equals sign.The priority of the options is left−to−right: when two options conflict, thefirst (most left) one takes effect. The −D and −U options are notconsidered conflicting options, so they are processed left−to−right for eachsource file. You can overrule the default output file name with the−−gen−c−file−name option.A summary of the options is given below. The next section describes theoptions in more detail.OptionDescription−? Display invocation syntax−−alternative−tokens−−no−alternative−tokensEnable or disable recognition ofalternative tokens••••••••


3−4Chapter 3USAGEOption−−anachronisms−−no−anachronisms−−arg−dep−lookup−−no−arg−dep−lookup−−array−new−and−delete−−no−array−new−and−delete−−auto−instantiation−−no−auto−instantiation−T−−base−assign−op−is−default−−no−base−assign−op−is−default−−bool−−no−bool−−brief−diagnostics−−no−brief−diagnostics−−cfront−2.1−b−−cfront−3.0−−class−name−injection−−no−class−name−injection−−comments−C−−const−string−literals−−no−const−string−literals−−create−pch file−−define macro[(parm−list)] [=def]−Dmacro[(parm−list)][=def]DescriptionEnable or disable anachronismsPerform argument dependent lookupof unqualified function namesEnable or disable support for arraynew and deleteEnable or disable automaticinstantiation of templatesEnable or disable the anachronism ofaccepting a copy assignment operatorwith a base class as a default for thederived classEnable or disable recognition of boolEnable or disable a shorter form ofdiagnostic outputCompile <strong>C++</strong> compatible with cfrontversion 2.1Compile <strong>C++</strong> compatible with cfrontversion 3.0Add class name to the scope of theclassKeep comments in the preprocessedoutputMake string literals constCreate a precompiled header file withthe specified nameDefine preprocessor macro


<strong>Compiler</strong> Use3−5Option−−dependencies−M−−diag−suppress tag[,tag]...−−diag−remark tag[,tag]...−−diag−warning tag[,tag]...−−diag−error tag[,tag]...−−display−error−number−−distinct−template−signatures−−no−distinct−template−signaturesDescriptionPreprocess only. Emit dependenciesfor makeOverride normal error severityDisplay error number in diagnosticmessagesDisallow or allow normal functions astemplate instantiation−−dollar−$ Accept dollar signs in identifiers−−early−tiebreaker−−embedded−−no−embedded−−embedded−c++−−enum−overloading−−no−enum−overloading−−error−limit number−enumber−−error−output efile−−exceptions−−no−exceptions−x−−explicit−−no−explicitEarly handling of tie−breakers inoverload resolutionEnable or disable support forembedded <strong>C++</strong> language extensionkeywordsEnable the diagnostics ofnoncompliance with the "Embedded<strong>C++</strong>" subsetEnable or disable operator functions tooverload builtin operators onenum−typed operandsSpecify maximum number of errorsSend diagnostics to error list fileEnable or disable support forexception handlingEnable or disable support for theexplicit specifier on constructordeclarations••••••••


3−6Chapter 3USAGEOption−−extended−variadic−macros−−no−extended−variadic−macros−−extern−inline−−no−extern−inline−f file−−force−vtbl−−for−init−diff−warning−−no−for−init−diff−warning−−friend−injection−−no−friend−injection−−gen−c−file−name file−o file−−guiding−decls−−no−guiding−decls−−implicit−extern−c−type−conversion−−no−implicit−extern−c−type−conversion−−implicit−include−−no−implicit−include−B−−implicit−typename−−no−implicit−typename−−incl−suffixes suffixesDescriptionAllow (or disallow) macros with avariable number of arguments andallow the naming of the listEnable or disable inline function withexternal <strong>C++</strong> linkageRead command line arguments fromfileForce definition of virtual functiontablesEnable or disable warning whenold−style for−scoping is usedControl the visibility of frienddeclarationsSpecify name of generated C outputfileEnable or disable recognition of"guiding declarations" of templatefunctionsEnable or disable implicit typeconversion between external C and<strong>C++</strong> function pointersEnable or disable implicit inclusion ofsource files as a method of findingdefinitions of template entities to beinstantiatedEnable or disable implicitdetermination, from context, whether atemplate parameter dependent nameis a type or nontypeSet the valid suffixes for include files


<strong>Compiler</strong> Use3−7Option−−include−directory dir−Idir−−include−file file−−inlining−−no−inlining−−instantiate mode−t mode−−instantiation−dir dir−−late−tiebreaker−−list−file lfile−L lfile−−long−lifetime−temps−−short−lifetime−temps−−long−preserving−rules−−no−long−preserving−rules−M[t|s|m|l|h]−−namespaces−−no−namespaces−−new−for−init−−no−code−gen−n−−no−line−commands−P−−nonconst−ref−anachronism−−no−nonconst−ref−anachronism−−nonstd−qualifier−deduction−−no−nonstd−qualifier−deductionDescriptionLook in directory dir for include filesInclude file at the beginning of thecompilationEnable or disable minimal inlining offunction callsControl instantiation of externaltemplate entitiesWrite instantiation files to dirLate handling of tie−breakers inoverload resolutionGenerate raw list file lfileSelect lifetime for temporariesEnable or disable K&R arithmeticconversion rules for longsSelect memory model: tiny, small,medium, large or hugeEnable or disable the support fornamespacesNew−style for−scoping rulesDo syntax checking onlyPreprocess only. Remove line controlinformation and commentsEnable or disable the anachronism ofallowing a reference to nonconst tobind to a class rvalue of the right typeUse (or do not use) a non−standardtemplate argument deduction method••••••••


3−8Chapter 3USAGEOption−−nonstd−using−decl−−no−nonstd−using−decl−−no−preproc−only−−no−use−before−set−warnings−j−−no−warnings−w−−old−for−init−−old−line−commands−−old−specializations−−no−old−specializations−−old−style−preprocessing−−one−instantiation−per−object−−output file−−pch−−pch−dir dir−−pch−messages−−no−pch−messages−−pch−verbose−−pending−instantiations n−−preprocess−E−−remarks−rDescriptionAllow or disallow unqualified name innon−member using declarationSpecify that a full compilation shouldbe done (not just preprocessing)Suppress warnings on local automaticvariables that are used before theirvalues are setSuppress all warning messagesOld−style for−scoping rulesPut out line control information in theform # nnn instead of #line nnnEnable or disable old−style templatespecializationForces pcc style preprocessingCreate separate instantiation filesWrite preprocess output in fileAutomatically use and/or create aprecompiled header fileSpecify directory dir in which to searchfor and/or create a precompiledheader fileEnable or disable the display of amessage indicating that a precompiledheader file was created or used in thecurrent compilationGenerate a message when aprecompiled header file cannot beusedMaximum number of instantiations fora single template (default 64)Preprocess only. Keep line controlinformation and remove commentsIssue remarks


<strong>Compiler</strong> Use3−9Option−−remove−unneeded−entities−−no−remove−unneeded−entities−−rtti−−no−rtti−−signed−chars−s−−special−subscript−cost−−no−special−subscript−cost−−strict−A−−strict−warnings−a−−suppress−typeinfo−vars−−suppress−vtblDescriptionEnable or disable the removal ofunneeded entities from the generatedintermediate C fileEnable or disable support for RTTI(run−time type information)Treat all ’char’ variables as signedEnable or disable a specialnonstandard weighting of theconversion to the integral operand ofthe [] operator in overload resolution.Strict ANSI <strong>C++</strong>. Issue errors onnon−ANSI featuresStrict ANSI <strong>C++</strong>. Issue warnings onnon−ANSI featuresSuppress type info variables ingenerated CSuppress definition of virtual functiontables−−sys−include dirLook in directory dir for system includefiles−−timing−# Generate compilation timinginformation−−trace−includes−H−−tsw−diagnostics−−no−tsw−diagnostics−−typename−−no−typename−−undefine macro−UmacroPreprocess only. Generate list ofincluded filesEnable or disable TASKING stylediagnostic messagesEnable or disable recognition oftypenameRemove preprocessor macro••••••••


3−10Chapter 3Option−−unsigned−chars−u−−use−pch file−−using−std−−no−using−std−−variadic−macros−−no−variadic−macros−−version−V−v−−wchar_t−keyword−−no−wchar_t−keyword−−wrap−diagnostics−−no−wrap−diagnostics−−xref xfile−X xfileDescriptionTreat all ’char’ variables as unsignedUse a precompiled header file of thespecified nameEnable or disable implicit use of thestd namespace when standardheader files are includedAllow (or disallow) macros with avariable number of argumentsDisplay version header onlyEnable or disable recognition ofwchar_t as a keywordEnable or disable wrapping ofdiagnostic messagesGenerate cross−reference file xfileTable 3−1: <strong>Compiler</strong> options (alphabetical)USAGEDescriptionInclude optionsLook in dir for include filesLook in dir for system include filesSet the valid suffixes for include filesInclude file at the beginning of thecompilationRead command line arguments fromfileOption−−include−directory dir−Idir−−sys−include dir−−incl−suffixes suffixes−−include−file file−f file


<strong>Compiler</strong> Use3−11DescriptionPreprocess optionsPreprocess only. Keep line controlinformation and remove commentsPreprocess only. Remove line controlinformation and commentsKeep comments in the preprocessedoutputDo syntax checking onlySpecify that a full compilation shouldbe done (not just preprocessing)Put out line control information in theform # nnn instead of #line nnnForces pcc style preprocessingPreprocess only. Emit dependenciesfor makePreprocess only. Generate list ofincluded filesDefine preprocessor macroRemove preprocessor macroAllow (or disallow) macros with avariable number of argumentsAllow (or disallow) macros with avariable number of arguments andallow the naming of the listLanguage control optionsStrict ANSI <strong>C++</strong>. Issue errors onnon−ANSI featuresStrict ANSI <strong>C++</strong>. Issue warnings onnon−ANSI featuresSelect memory model: tiny, small,medium, large or hugeCompile <strong>C++</strong> compatible with cfrontversion 2.1Compile <strong>C++</strong> compatible with cfrontversion 3.0Option−−preprocess−E−−no−line−commands−P−−comments−C−−no−code−gen−n−−no−preproc−only−−old−line−commands−−old−style−preprocessing−−dependencies−M−−trace−includes−H−−define macro[(parm−list)] [=def]−Dmacro[(parm−list)][=def]−−undefine macro−Umacro−−variadic−macros−−no−variadic−macros−−extended−variadic−macros−−no−extended−variadic−macros−−strict−A−−strict−warnings−a−M[t|s|m|l|h]−−cfront−2.1−b−−cfront−3.0••••••••


3−12Chapter 3USAGEDescriptionAccept dollar signs in identifiersTreat all ’char’ variables as signedTreat all ’char’ variables as unsignedEnable or disable K&R arithmeticconversion rules for longsMake string literals constEnable or disable support forexception handlingEnable the diagnostics ofnoncompliance with the "Embedded<strong>C++</strong>" subsetEnable or disable support forembedded <strong>C++</strong> language extensionkeywordsEnable or disable operator functions tooverload builtin operators onenum−typed operandsEnable or disable support for theexplicit specifier on constructordeclarationsEnable or disable inline function withexternal <strong>C++</strong> linkageEnable or disable implicit typeconversion between external C and<strong>C++</strong> function pointersSuppress type info variables ingenerated CSuppress definition of virtual functiontablesForce definition of virtual functiontablesEnable or disable anachronismsOption−−dollar−$−−signed−chars−s−−unsigned−chars−u−−long−preserving−rules−−no−long−preserving−rules−−const−string−literals−−no−const−string−literals−−exceptions−−no−exceptions−x−−embedded−c++−−embedded−−no−embedded−−enum−overloading−−no−enum−overloading−−explicit−−no−explicit−−extern−inline−−no−extern−inline−−implicit−extern−c−type−conversion−−no−implicit−extern−c−type−conversion−−suppress−typeinfo−vars−−suppress−vtbl−−force−vtbl−−anachronisms−−no−anachronisms


<strong>Compiler</strong> Use3−13DescriptionEnable or disable the anachronism ofaccepting a copy assignment operatorwith a base class as a default for thederived classEnable or disable the anachronism ofallowing a reference to nonconst tobind to a class rvalue of the right typeUse (or do not use) a non−standardtemplate argument deduction methodAllow or disallow unqualified name innon−member using declarationPerform argument dependent lookupof unqualified function namesAdd class name to the scope of theclassControl the visibility of frienddeclarationsEarly or late handling of tie−breakersin overload resolutionEnable or disable support for arraynew and deleteEnable or disable support fornamespacesNew−style for−scoping rulesOld−style for−scoping rulesEnable or disable implicit use of thestd namespace when standardheader files are includedEnable or disable support for RTTI(run−time type information)Enable or disable recognition of boolEnable or disable recognition oftypenameEnable or disable implicitdetermination, from context, whether atemplate parameter dependent nameis a type or nontypeOption−−base−assign−op−is−default−−no−base−assign−op−is−default−−nonconst−ref−anachronism−−no−nonconst−ref−anachronism−−nonstd−qualifier−deduction−−no−nonstd−qualifier−deduction−−nonstd−using−decl−−no−nonstd−using−decl−−arg−dep−lookup−−no−arg−dep−lookup−−class−name−injection−−no−class−name−injection−−friend−injection−−no−friend−injection−−early−tiebreaker−−late−tiebreaker−−array−new−and−delete−−no−array−new−and−delete−−namespaces−−no−namespaces−−new−for−init−−old−for−init−−using−std−−no−using−std−−rtti−−no−rtti−−bool−−no−bool−−typename−−no−typename−−implicit−typename−−no−implicit−typename••••••••


3−14Chapter 3USAGEDescriptionEnable or disable a specialnonstandard weighting of theconversion to the integral operand ofthe [] operator in overload resolution.Enable or disable recognition ofwchar_t as a keywordSelect lifetime for temporariesEnable or disable recognition ofalternative tokensEnable or disable minimal inlining offunction callsEnable or disable the removal ofunneeded entities from the generatedintermediate C fileTemplate instantiation optionsControl instantiation of externaltemplate entitiesEnable or disable automaticinstantiation of templatesCreate separate instantiation filesWrite instantiation files to dirEnable or disable implicit inclusion ofsource files as a method of findingdefinitions of template entities to beinstantiatedMaximum number of instantiations fora single template (default 64)Dis−allow or allow normal functions astemplate instantiationEnable or disable recognition of"guiding declarations" of templatefunctionsEnable or disable old−style templatespecializationOption−−special−subscript−cost−−no−special−subscript−cost−−wchar_t−keyword−−no−wchar_t−keyword−−long−lifetime−temps−−short−lifetime−temps−−alternative−tokens−−no−alternative−tokens−−inlining−−no−inlining−−remove−unneeded−entities−−no−remove−unneeded−entities−−instantiate mode−t mode−−auto−instantiation−−no−auto−instantiation−T−−one−instantiation−per−object−−instantiation−dir dir−−implicit−include−−no−implicit−include−B−−pending−instantiations n−−distinct−template−signatures−−no−distinct−template−signatures−−guiding−decls−−no−guiding−decls−−old−specializations−−no−old−specializations


<strong>Compiler</strong> Use3−15DescriptionPrecompiled header optionsAutomatically use and/or create aprecompiled header fileCreate a precompiled header file withthe specified nameUse a precompiled header file of thespecified nameSpecify directory dir in which to searchfor and/or create a precompiledheader fileEnable or disable the display of amessage indicating that a precompiledheader file was created or used in thecurrent compilationGenerate a message when aprecompiled header file cannot beusedOutput file optionsWrite preprocess output in fileSpecify name of generated C outputfileDiagnostic optionsDisplay invocation syntax −?Display version header onlyGenerate compilation timinginformationSend diagnostics to error list fileGenerate raw list file lfileGenerate cross−reference file xfileOverride normal error severityDisplay error number in diagnosticmessagesOption−−pch−−create−pch file−−use−pch file−−pch−dir dir−−pch−messages−−no−pch−messages−−pch−verbose−−output file−−gen−c−file−name file−o file−−version−V−v−−timing−#−−error−output efile−−list−file lfile−L lfile−−xref xfile−X xfile−−diag−suppress tag[,tag]...−−diag−remark tag[,tag]...−−diag−warning tag[,tag]...−−diag−error tag[,tag]...−−display−error−number••••••••


USAGE3−16Chapter 3DescriptionSpecify maximum number of errorsIssue remarksSuppress all warning messagesSuppress warnings on local automaticvariables that are used before theirvalues are setEnable or disable a shorter form ofdiagnostic outputEnable or disable TASKING stylediagnostic messagesEnable or disable wrapping ofdiagnostic messagesEnable or disable warning whenold−style for−scoping is usedOption−−error−limit number−enumber−−remarks−r−−no−warnings−w−−no−use−before−set−warnings−j−−brief−diagnostics−−no−brief−diagnostics−−tsw−diagnostics−−no−tsw−diagnostics−−wrap−diagnostics−−no−wrap−diagnostics−−for−init−diff−warning−−no−for−init−diff−warningTable 3−2: <strong>Compiler</strong> options (functional)3.1.1 DETAILED DESCRIPTION OF THE COMPILEROPTIONSOption letters are listed below. If the same option is used more than once,the first (most left) occurrence is used. The placement of command lineoptions is of no importance except for the −I option. Some options alsohave a "no−" form. These options are described together.


<strong>Compiler</strong> Use3−17−?Option:−?Description:Display an explanation of options at stdout.Example:cp166 −?••••••••


3−18Chapter 3−−alternative−tokensOption:−−alternative−tokens−−no−alternative−tokensDefault:−−alternative−tokensDescription:Enable or disable recognition of alternative tokens. This controlsrecognition of the digraph tokens in <strong>C++</strong>, and controls recognition of theoperator keywords (e.g., not, and, bitand, etc.).Example:To disable operator keywords (e.g., "not", "and") and digraphs, enter:cp166 −−no−alternative−tokens test.ccUSAGE


<strong>Compiler</strong> Use3−19−−anachronismsOption:−−anachronisms−−no−anachronismsDefault:−−no−anachronismsDescription:Enable or disable anachronisms.Example:cp166 −−anachronisms test.cc−−nonconst−ref−anachronisms,−−cfront−2.1 / −b / −−cfront−3.0Section Anachronisms Accepted in chapter Language Implementation.••••••••


3−20Chapter 3−−arg−dep−lookupOption:−−arg−dep−lookup−−no−arg−dep−lookupDefault:−−arg−dep−lookupDescription:Controls whether argument dependent lookup of unqualified functionnames is performed.Example:cp166 −−no−arg−dep−lookup test.ccUSAGE


<strong>Compiler</strong> Use3−21−−array−new−and−deleteOption:−−array−new−and−delete−−no−array−new−and−deleteDefault:−−array−new−and−deleteDescription:Enable or disable support for array new and delete.Example:cp166 −−no−array−new−and−delete test.cc••••••••


3−22Chapter 3−−auto−instantiation / −TOption:−T / −−auto−instantiation−−no−auto−instantiationDefault:−−auto−instantiationDescription:−T is equivalent to −−auto−instantiation. Enable or disable automaticinstantiation of templates.Example:cp166 −−no−auto−instantiation test.cc−−instantiate / −tSection Template Instantiation in chapter Language Implementation.USAGE


<strong>Compiler</strong> Use3−23−−base−assign−op−is−defaultOption:−−base−assign−op−is−default−−no−base−assign−op−is−defaultDefault:−−base−assign−op−is−default (in cfront compatibility mode)Description:Enable or disable the anachronism of accepting a copy assignmentoperator that has an input parameter that is a reference to a base class as adefault copy assignment operator for the derived class.Example:cp166 −−base−assign−op−is−default test.cc••••••••


3−24Chapter 3−−boolOption:−−bool−−no−boolDefault:−−boolDescription:Enable or disable recognition of the bool keyword.Example:cp166 −−no−bool test.ccUSAGE


<strong>Compiler</strong> Use3−25−−brief−diagnosticsOption:−−brief−diagnostics−−no−brief−diagnosticsDefault:−−brief−diagnosticsDescription:Enable or disable a mode in which a shorter form of the diagnostic outputis used. When enabled, the original source line is not displayed and theerror message text is not wrapped when too long to fit on a single line.Example:cp166 −−no−brief−diagnostics test.cc−−wrap−diagnosticsChapter <strong>Compiler</strong> Diagnostics and Appendix Error Messages.••••••••


3−26Chapter 3−−cfront−version / −bOption:−b / −−cfront−2.1−−cfront−3.0Default:Normal <strong>C++</strong> mode.Description:−b is equivalent to −−cfront−2.1. −−cfront−2.1 or −−cfront−3.0 enablecompilation of <strong>C++</strong> with compatibility with cfront version 2.1 or 3.0respectively. This causes the compiler to accept language constructs that,while not part of the <strong>C++</strong> language definition, are accepted by the AT&T<strong>C++</strong> Language System (cfront) release 2.1 or 3.0 respectively. Theseoptions also enable acceptance of anachronisms.Example:To compile <strong>C++</strong> compatible with cfront version 3.0, enter:cp166 −−cfront−3.0 test.cc−−anachronismsSection Extensions Accepted in Cfront 2.1 and 3.0 Compatibility Mode inchapter Language Implementation.USAGE


<strong>Compiler</strong> Use3−27−−class−name−injectionOption:−−class−name−injection−−no−class−name−injectionDefault:−−class−name−injectionDescription:Controls whether the name of a class is injected into the scope of the class(as required by the standard) or is not injected (as was true in earlierversions of the <strong>C++</strong> language).Example:cp166 −−no−class−name−injection test.cc••••••••


3−28Chapter 3−−comments / −COption:−C−−commentsDescription:Keep comments in the preprocessed output. This should be specified aftereither −−preprocess or −−no−line−commands; it does not of itselfrequest preprocessing output.Example:To do preprocessing only, with comments and with line controlinformation, enter:cp166 −E −C test.cc−−preprocess / −E, −−no−line−commands / −PUSAGE


<strong>Compiler</strong> Use3−29−−const−string−literalsOption:−−const−string−literals−−no−const−string−literalsDefault:−−const−string−literalsDescription:Control whether <strong>C++</strong> string literals and wide string literals are const (asrequired by the standard) or non−const (as was true in earlier versions ofthe <strong>C++</strong> language).Example:cp166 −−no−const−string−literals test.cc••••••••


3−30Chapter 3−−create−pchOption:−−create−pch filenameArguments:A filename specifying the precompiled header file to create.Description:If other conditions are satisfied (see the Precompiled Headers section),create a precompiled header file with the specified name. If −−pch(automatic PCH mode) or −−use−pch appears on the command linefollowing this option, its effect is erased.Example:To create a precompiled header file with the name test.pch, enter:cp166 −−create−pch test.pch test.cc−−pch, −−use−pchSection Precompiled Headers in chapter Language Implementation.USAGE


<strong>Compiler</strong> Use3−31−−define / −DOption:−Dmacro [(parm−list)][=def]−−define macro [(parm−list)][=def]Arguments:The macro you want to define and optionally its definition.Description:Define macro to the preprocessor, as in #define. If def is not given (’=’ isabsent), ’1’ is assumed. Function−style macros can be defined byappending a macro parameter list to name. Any number of symbols canbe defined. The definition can be tested by the preprocessor with #if,#ifdef and #ifndef, for conditional compilations.Example:cp166 −DNORAM −DPI=3.1416 test.cc−−undefine / −U••••••••


3−32Chapter 3−−dependencies / −MOption:−M−−dependenciesDescription:Do preprocessing only. Instead of the normal preprocessing output,generate on the preprocessing output file a list of dependency linessuitable for input to a ’make’ utility.When implicit inclusion of templates is enabled, the output may indicatefalse (but safe) dependencies unless −−no−preproc−only is also used.When you use the control program you have to use the −Em optioninstead, to obtain the same result.Examples:cp166 −M test.cctest.ic: test.cc−−preprocess / −E, −−no−line−commands / −PUSAGE


<strong>Compiler</strong> Use3−33−−diag−optionOption:−−diag−suppress tag[,tag]...−−diag−remark tag[,tag]...−−diag−warning tag[,tag]...−−diag−error tag[,tag]...Arguments:A mnemonic error tag or an error number.Description:Override the normal error severity of the specified diagnostic messages.The message(s) may be specified using a mnemonic error tag or using anerror number. The error tag names and error numbers are listed in theError Messages appendix.Example:When you want diagnostic error 20 to be a warning, enter:cp166 −−diag−warning 20 test.ccChapter <strong>Compiler</strong> Diagnostics and Appendix Error Messages.••••••••


3−34Chapter 3−−display−error−numberOption:−−display−error−numberDescription:Display the error message number in any diagnostic messages that aregenerated. The option may be used to determine the error number to beused when overriding the severity of a diagnostic message. The errornumbers are listed in the Error Messages appendix.Normally, diagnostics are written to stderr in the following form:"filename", line line_num: messageWith −−display−error−number this form will be:or:"filename", line line_num: severity #err_num: message"filename", line line_num: severity #err_num−D: messageIf the severity may be overridden, the error number will include the suffix−D (for discretionary); otherwise no suffix will be present.Example:cp166 −−display−error−number test.cc"test.cc", line 7: error #64−D: declaration does notdeclare anythingstruct ;^Chapter <strong>Compiler</strong> Diagnostics and Appendix Error Messages.USAGE


<strong>Compiler</strong> Use3−35−−distinct−template−signaturesOption:−−distinct−template−signatures−−no−distinct−template−signaturesDefault:−−distinct−template−signaturesDescription:Control whether the signatures for template functions can match those fornon−template functions when the functions appear in different compilationunits. The default is −−distinct−template−signatures, under which anormal function cannot be used to satisfy the need for a template instance;e.g., a function "void f(int)" could not be used to satisfy the need foran instantiation of a template "void f(T)" with T set to int.−−no−distinct−template−signatures provides the older languagebehavior, under which a non−template function can match a templatefunction. Also controls whether function templates may have templateparameters that are not used in the function signature of the functiontemplateExample:cp166 −−no−distinct−template−signatures test.cc••••••••


3−36Chapter 3−−dollar / −$Option:−$−−dollarDefault:No dollar signs are allowed in identifiers.Description:Accept dollar signs in identifiers. Names like A$VAR are allowed.Example:cp166 −$ test.ccUSAGE


<strong>Compiler</strong> Use3−37−−early−tiebreaker /−−late−tiebreakerOption:−−early−tiebreaker−−late−tiebreakerDefault:−−early−tiebreakerDescription:Select the way that tie−breakers (e.g., cv−qualifier differences) apply inoverload resolution. In "early" tie−breaker processing, the tie−breakers areconsidered at the same time as other measures of the goodness of thematch of an argument value and the corresponding parameter type (this isthe standard approach). In "late" tie−breaker processing, tie−breakers areignored during the initial comparison, and considered only if twofunctions are otherwise equally good on all arguments; the tie−breakerscan then be used to choose one function over another.Example:cp166 −−late−tiebreaker test.cc••••••••


3−38Chapter 3−−embeddedOption:−−embedded−−no−embeddedDefault:−−embeddedDescription:Enable or disable support for embedded <strong>C++</strong> language extensionkeywords.Example:To disable embedded <strong>C++</strong> language extension keywords, enter:cp166 −−no−embedded test.ccUSAGE


<strong>Compiler</strong> Use3−39−−embedded−c++Option:−−embedded−c++Description:Enable the diagnostics of noncompliance with the Embedded <strong>C++</strong>" subset(from which templates, exceptions, namespaces, new−style casts, RTTI,multiple inheritance, virtual base classes, and mutable are excluded.Example:To enable the diagnostics of noncompliance with the Embedded <strong>C++</strong>"subset, enter:cp166 −−embedded−c++ test.cc••••••••


3−40Chapter 3−−enum−overloadingOption:−−enum−overloading−−no−enum−overloadingDefault:−−enum−overloadingDescription:Enable or disable support for using operator functions to overload builtinoperations on enum−typed operands.Example:To disable overloading builtin operations on enum−typed operands, enter:cp166 −−no−enum−overloading test.ccUSAGE


<strong>Compiler</strong> Use3−41−−error−limit / −eOption:−enumber−−error−limit numberArguments:An error limit number.Default:−−error−limit 100Description:Set the error limit to number. The <strong>C++</strong> compiler will abandon compilationafter this number of errors (remarks and warnings are not counted towardthe limit). By default, the limit is 100.Example:When you want compilation to stop when 10 errors occurred, enter:cp166 −e10 test.cc••••••••


3−42Chapter 3−−error−outputOption:−−error−output efileArguments:The name for an error output file.Description:Redirect the output that would normally go to stderr (that is, diagnosticmessages) to the file efile. This option is useful on systems where outputredirection of files is not well supported. If used, this option shouldprobably be specified first in the command line, since otherwise anycommand−line errors for options preceding the −−error−output would bewritten to stderr before redirection.Example:To write errors to the file test.err instead of stderr, enter:cp166 −−error−output test.err test.ccUSAGE


<strong>Compiler</strong> Use3−43−−exceptions / −xOption:−x / −−exceptions−−no−exceptionsDefault:−−no−exceptionsDescription:Enable or disable support for exception handling. −x is equivalent to−−exceptions.Example:cp166 −−exceptions test.cc••••••••


3−44Chapter 3−−explicitOption:−−explicit−−no−explicitDefault:−−explicitDescription:Enable or disable support for the explicit specifier on constructordeclarations.Example:To disable support for the explicit specifier on constructor declarations,enter:cp166 −−no−explicit test.ccUSAGE


<strong>Compiler</strong> Use3−45−−extended−variadic−macrosOption:−−extended−variadic−macros−−no−extended−variadic−macrosDefault:−−no−extended−variadic−macrosDescription:Allow or disallow macros with a variable number of arguments (implies−−variadic−macros) and alow or disallow the naming of the variableargument list.Example:cp166 −−extended−variadic−macros test.cc−−variadic−macros••••••••


3−46Chapter 3−−extern−inlineOption:−−extern−inline−−no−extern−inlineDefault:−−extern−inlineDescription:Enable or disable support for inline functions with external linkage in<strong>C++</strong>. When inline functions are allowed to have external linkage (asrequired by the standard), then extern and inline are compatiblespecifiers on a non−member function declaration; the default linkage wheninline appears alone is external (that is, inline means externinline on non−member functions); and an inline member functiontakes on the linkage of its class (which is usually external). However,when inline functions have only internal linkage (as specified in theARM), then extern and inline are incompatible; the default linkagewhen inline appears alone is internal (that is, inline means staticinline on non−member functions); and inline member functions haveinternal linkage no matter what the linkage of their class.Example:cp166 −−no−extern−inline test.ccUSAGE


<strong>Compiler</strong> Use3−47−fOption:−f filenameArguments:The name of an option file.Description:Instead of typing all options on the command line, you can create anoption file which contains all options and files you want to specify. Withthis option you specify the option file to the <strong>C++</strong> compiler.Use an option file when the length of the command line would exceed thelimits of the operating system, or just to store options and save typing.You can specify the option −f multiple times.Format of an option file:• Multiple command line arguments on one line in the option file areallowed.• To include whitespace in an argument, surround the argument withsingle or double quotes.• If you want to use single quotes as part of the argument, surround theargument by double quotes and vise versa:"This has a single quote ’ embedded"’This has a double quote " embedded’’This has a double quote " and \a single quote ’"’ embedded"• When a text line reaches its length limit, use a ’\’ to continue the line.Whitespace between quotes is preserved."This is a continuation \line"−> "This is a continuation line"• It is possible to nest command line files up to 25 levels.••••••••


3−48Chapter 3Example:Suppose the file myoptions contains the following lines:−I/proj/includetest.ccSpecify the option file to the <strong>C++</strong> compiler:cp166 −f myoptionsThis is equivalent to the following command line:cp166 −I/proj/include test.ccUSAGE


<strong>Compiler</strong> Use3−49−−for−init−diff−warningOption:−−for−init−diff−warning−−no−for−init−diff−warningDefault:−−for−init−diff−warningDescription:Enable or disable a warning that is issued when programs compiled underthe new for−init scoping rules would have had different behavior underthe old rules. The diagnostic is only put out when the new rules are used.Example:cp166 −−no−for−init−diff−warning test.cc−−new−for−init / −−old−for−init••••••••


3−50Chapter 3−−force−vtblOption:−−force−vtblDescription:Force definition of virtual function tables in cases where the heuristic usedby the <strong>C++</strong> compiler to decide on definition of virtual function tablesprovides no guidance. See −−suppress−vtbl.Example:cp166 −−force−vtbl test.cc−−suppress−vtblUSAGE


<strong>Compiler</strong> Use3−51−−friend−injectionOption:−−friend−injection−−no−friend−injectionDefault:−−no−friend−injectionDescription:Controls whether the name of a class or function that is declared only infriend declarations is visible when using the normal lookup mechanisms.When friend names are injected, they are visible to such lookups. Whenfriend names are not injected (as required by the standard), functionnames are visible only when using argument−dependent lookup, and classnames are never visible.Example:cp166 −−friend−injection test.cc−−arg−dep−lookup••••••••


3−52Chapter 3−−gen−c−file−name / −oOption:−o file−−gen−c−file−name fileArguments:An output filename.Default:Module name with .ic suffix.Description:This option specifies the file name to be used for the generated C output.Example:To specify the file out.ic as the output file instead of test.ic, enter:cp166 −−gen−c−file−name out.ic test.ccUSAGE


<strong>Compiler</strong> Use3−53−−guiding−declsOption:−−guiding−decls−−no−guiding−declsDefault:−−guiding−declsDescription:Enable or disable recognition of guiding declarations" of templatefunctions. A guiding declaration is a function declaration that matches aninstance of a function template but has no explicit definition (since itsdefinition derives from the function template). For example:template void f(T) { ... }void f(int);When regarded as a guiding declaration, f(int) is an instance of thetemplate; otherwise, it is an independent function for which a definitionmust be supplied. If −−no−guiding−decls is combined with−−old−specializations, a specialization of a non−member templatefunction is not recognized −− it is treated as a definition of an independentfunction.Example:cp166 −−no−guiding−decls test.cc−−old−specializations••••••••


3−54Chapter 3−−implicit−extern−c−type−conversionOption:−−implicit−extern−c−type−conversion−−no−implicit−extern−c−type−conversionDefault:−−implicit−extern−c−type−conversionDescription:Enable or disable an extension to permit implicit type conversion in <strong>C++</strong>between a pointer to an extern "C" function and a pointer to anextern "<strong>C++</strong>" function. This extension is allowed in environmentswhere C and <strong>C++</strong> functions share the same calling conventions.Example:cp166 −−no−implicit−extern−c−type−conversion test.ccUSAGE


<strong>Compiler</strong> Use3−55−−implicit−include / −BOption:−B / −−implicit−include−−no−implicit−includeDefault:−−no−implicit−includeDescription:Enable or disable implicit inclusion of source files as a method of findingdefinitions of template entities to be instantiated. −B is equivalent to−−implicit−include.Example:cp166 −−implicit−include test.cc−−instantiate / −tSection Template Instantiation in chapter Language Implementation.••••••••


3−56Chapter 3−−implicit−typenameOption:−−implicit−typename−−no−implicit−typenameDefault:−−implicit−typenameDescription:Enable or disable implicit determination, from context, whether a templateparameter dependent name is a type or nontype.Example:cp166 −−no−implicit−typename test.cc−−typenameUSAGE


<strong>Compiler</strong> Use3−57−−incl−suffixesOption:−−include−suffixes suffixesArguments:A colon−separated list of suffixes (e.g., "h:hpp::").Description:Specifies the list of suffixes to be used when searching for an include filewhose name was specified without a suffix. If a null suffix is to beallowed, it must be included in the suffix list.The default suffix list is no extension, .h and .hpp.Example:To allow only the suffixes .h and .hpp as include file extensions, enter:cp166 −−incl−suffixes h:hpp test.ccSection 3.2, Include Files.••••••••


3−58Chapter 3−−include−directory / −IOption:−Idirectory−−include−directory directoryArguments:The name of the directory to search for include file(s).Description:Change the algorithm for searching #include files whose names do nothave an absolute pathname to look in directory.Example:cp166 −I/proj/include test.ccSection 3.2, Include Files.−−sys−includeUSAGE


<strong>Compiler</strong> Use3−59−−include−fileOption:−−include−file filenameArguments:The name of the file to be included at the beginning of the compilation.Description:Include the source code of the indicated file at the beginning of thecompilation. This can be used to establish standard macro definitions, etc.The filename is searched for in the directories on the include search list.Example:cp166 −−include−file extra.h test.ccSection 3.2, Include Files.••••••••


3−60Chapter 3−−inliningOption:−−inlining−−no−inliningDefault:−−inliningDescription:Enable or disable minimal inlining of function calls.Example:To disable function call inlining, enter:cp166 −−no−inlining test.ccUSAGE


<strong>Compiler</strong> Use3−61−−instantiate / −tOption:−tmode−−instantiate modePragma:instantiate modeArguments:The instantiation mode, which can be one of:noneusedalllocalDefault:−tnoneDescription:Control instantiation of external template entities. External template entitiesare external (that is, noninline and nonstatic) template functions andtemplate static data members. The instantiation mode determines thetemplate entities for which code should be generated based on thetemplate definition:noneusedalllocalInstantiate no template entities. This is the default.Instantiate only the template entities that are used in thiscompilation.Instantiate all template entities whether or not they are used.Instantiate only the template entities that are used in thiscompilation, and force those entities to be local to thiscompilation.••••••••


3−62Chapter 3Example:To specify to instantiate only the template entities that are used in thiscompilation, enter:cp166 −tused test.cc−−auto−instantiation / −TSection Template Instantiation in chapter Language Implementation.USAGE


<strong>Compiler</strong> Use3−63−−instantiation−dirOption:−−instantiation−dir directoryArguments:The name of the directory to write instantiation files to.Description:You can use this option in combination with option−−one−instantiation−per−object to specify a directory into which thegenerated object files should be put.Example:To create separate instantiation files in directory /proj/template, enter:cp166 −−one−instantiation−per−object \−−instantiation−dir /proj/template test.ccSection Template Instantiation in chapter Language Implementation.−−one−instantiation−per−object••••••••


3−64Chapter 3−−list−file / −LOption:−Llfile−−list−file lfileArguments:The name of the list file.Description:Generate raw listing information in the file lfile. This information is likelyto be used to generate a formatted listing. The raw listing file contains rawsource lines, information on transitions into and out of include files, anddiagnostics generated by the <strong>C++</strong> compiler. Each line of the listing filebegins with a key character that identifies the type of line, as follows:N: a normal line of source; the rest of the line is the text of the line.X: the expanded form of a normal line of source; the rest of the line is thetext of the line. This line appears following the N line, and only if theline contains non−trivial modifications (comments are considered trivialmodifications; macro expansions, line splices, and trigraphs areconsidered non−trivial modifications).S: a line of source skipped by an #if or the like; the rest of the line is text.Note that the #else, #elif, or #endif that ends a skip is marked with anN.L: an indication of a change in source position. The line has a formatsimilar to the # line−identifying directive output by cpp, that is to sayL line_number "file−name" keywhere key is,USAGE1 for entry into an include file;2 for exit from an include file;and omitted otherwise.


<strong>Compiler</strong> Use3−65The first line in the raw listing file is always an L line identifying theprimary input file. L lines are also output for #line directives (key isomitted). L lines indicate the source position of the following sourceline in the raw listing file.R, W, E, or C: an indication of a diagnostic (R for remark, W for warning,E for error, and C for catastrophic error). The line has the formS "file−name" line_number column−number message−textwhere S is R, W, E, or C, as explained above. Errors at the end of fileindicate the last line of the primary source file and a column number ofzero. Command line errors are catastrophes with an empty file name("") and a line and column number of zero. Internal errors arecatastrophes with position information as usual, and message−textbeginning with (internal error). When a diagnostic displays a list (e.g.,all the contending routines when there is ambiguity on an overloadedcall), the initial diagnostic line is followed by one or more lines withthe same overall format (code letter, file name, line number, columnnumber, and message text), but in which the code letter is the lowercase version of the code letter in the initial line. The source position insuch lines is the same as that in the corresponding initial line.Example:To write raw listing information to the file test.lst, enter:cp166 −L test.lst test.cc••••••••


USAGE3−66Chapter 3−−long−lifetime−temps /−−short−lifetime−tempsOption:−−long−lifetime−temps−−short−lifetime−tempsDefault:−−long−lifetime−temps−−short−lifetime−temps(cfront)(standard <strong>C++</strong>)Description:Select the lifetime for temporaries: short means to end of full expression;long means to the earliest of end of scope, end of switch clause, or thenext label. Short is standard <strong>C++</strong>, and long is what cfront uses (the cfrontcompatibility modes select long by default).Example:cp166 −−long−lifetime−temps test.cc


<strong>Compiler</strong> Use3−67−−long−preserving−rulesOption:−−long−preserving−rules−−no−long−preserving−rulesDefault:−−no−long−preserving−rulesDescription:Enable or disable the K&R usual arithmetic conversion rules with respectto long. This means the rules of K&R I, Appendix A, 6.6. The significantdifference is in the handling of "long op unsigned int" when intand long are the same size. The ANSI/ISO rules say the result isunsigned long, but K&R I says the result is long (unsigned long didnot exist in K&R I).The default is the ANSI/ISO rule.Example:cp166 −−long−preserving−rules test.cc••••••••


USAGE3−68Chapter 3−MmodelOption:−MmodelArguments:The memory model to be used, where model is one of:tsmlhtiny (cpu in non−segmented mode)small (default)mediumlargehugeDefault:−MsDescription:Select memory model to be used.Example:cp166 −Ml test.ccSection Memory Models in chapter Language Implementation in the<strong>C166</strong>/<strong>ST10</strong> C Cross−<strong>Compiler</strong> User’s <strong>Manual</strong>.


<strong>Compiler</strong> Use3−69−−namespacesOption:−−namespaces−−no−namespacesDefault:−−namespacesDescription:Enable or disable support for namespaces.Example:cp166 −−no−namespaces test.cc−−using−stdSection Namespace Support in chapter Language Implementation.••••••••


3−70Chapter 3−−new−for−init / −−old−for−initOption:−−new−for−init−−old−for−initDefault:−−new−for−initDescription:Control the scope of a declaration in a for−init−statement. The old(cfront−compatible) scoping rules mean the declaration is in the scope towhich the for statement itself belongs; the new (standard−conforming)rules in effect wrap the entire for statement in its own implicitlygenerated scope.Example:cp166 −−old−for−init test.ccUSAGE


<strong>Compiler</strong> Use3−71−−no−code−gen / −nOption:−n−−no−code−genDescription:Do syntax−checking only. Do not generate a C file.Example:cp166 −−no−code−gen test.cc••••••••


3−72Chapter 3−−no−line−commands / −POption:−P−−no−line−commandsDescription:Do preprocessing only. Write preprocessed text to the preprocessingoutput file, with comments removed and without line control information.When you use the −P option, use the −−output option to separate theoutput from the header produced by the compiler.Example:cp166 −P −−output preout test.cc−−comments / −C, −−preprocess / −E, −−dependencies / −MUSAGE


<strong>Compiler</strong> Use3−73−−nonconst−ref−anachronismOption:−−nonconst−ref−anachronism−−no−nonconst−ref−anachronismDefault:−−nonconst−ref−anachronismDescription:Enable or disable the anachronism of allowing a reference to nonconst tobind to a class rvalue of the right type. This anachronism is also enabledby the −−anachronisms option and the cfront−compatibility options.Example:cp166 −−no−nonconst−ref−anachronism test.cc−−anachronisms, −−cfront−2.1 / −b / −−cfront−3.0Section Anachronisms Accepted in chapter Language Implementation.••••••••


3−74Chapter 3−−nonstd−qualifier−deductionOption:−−nonstd−qualifier−deduction−−no−nonstd−qualifier−deductionDefault:−−no−nonstd−qualifier−deductionDescription:Controls whether nonstandard template argument deduction should beperformed in the qualifier portion of a qualified name. With this featureenabled, a template argument for the template parameter T can bededuced in contexts like A::B or T::B. The standard deductionmechanism treats these as nondeduced contexts that use the values oftemplate parameters that were either explicitly specified or deducedelsewhere.Example:cp166 −−nonstd−qualifier−deduction test.ccUSAGE


<strong>Compiler</strong> Use3−75−−nonstd−using−declOption:−−nonstd−using−decl−−no−nonstd−using−declDefault:−−no−nonstd−using−declDescription:Controls whether a non−member using declaration that specifies anunqualified name is allowed.Example:cp166 −−nonstd−using−decl test.cc••••••••


3−76Chapter 3−−no−preproc−onlyOption:−−no−preproc−onlyDescription:May be used in conjunction with the options that normally cause the <strong>C++</strong>compiler to do preprocessing only (e.g., −−preprocess, etc.) to specifythat a full compilation should be done (not just preprocessing). Whenused with the implicit inclusion option, this makes it possible to generate apreprocessed output file that includes any implicitly included files.Examples:cp166 −E −B −−no−preproc−only test.cc−−preprocess / −E,−−implicit−include / −B, −−no−line−commands / −PUSAGE


<strong>Compiler</strong> Use3−77−−no−use−before−set−warnings / −jOption:−j−−no−use−before−set−warningsDescription:Suppress warnings on local automatic variables that are used before theirvalues are set.Example:cp166 −j test.cc−−no−warnings / −w••••••••


3−78Chapter 3−−no−warnings / −wOption:−w−−no−warningsDescription:Suppress all warning messages. Error messages are still issued.Example:To suppress all warnings, enter:cp166 −w test.ccUSAGE


<strong>Compiler</strong> Use3−79−−old−line−commandsOption:−−old−line−commandsDescription:When generating source output, put out #line directives in the form usedby the Reiser cpp, that is, # nnn instead of #line nnn.Example:To do preprocessing only, without comments and with old style linecontrol information, enter:cp166 −E −−old−line−commands test.cc−−preprocess / −E, −−no−line−commands / −P••••••••


3−80Chapter 3−−old−specializationsOption:−−old−specializations−−no−old−specializationsDefault:−−old−specializationsDescription:Enable or disable acceptance of old−style template specializations (that is,specializations that do not use the template syntax).Example:cp166 −−no−old−specializations test.ccUSAGE


<strong>Compiler</strong> Use3−81−−old−style−preprocessingOption:−−old−style−preprocessingDescription:Forces pcc style preprocessing when compiling. This may be used whencompiling an ANSI <strong>C++</strong> program on a system in which the system headerfiles require pcc style preprocessing.Example:To force pcc style preprocessing, enter:cp166 −E −−old−style−preprocessing test.cc−−preprocess / −E, −−no−line−commands / −P••••••••


3−82Chapter 3−−one−instantiation−per−objectOption:−−one−instantiation−per−objectDescription:Put out each template instantiation in this compilation (function or staticdata member) in a separate object file. The primary object file containseverything else in the compilation, that is, everything that is not aninstantiation. Having each instantiation in a separate object file is veryuseful when creating libraries, because it allows the user of the library topull in only the instantiations that are needed. That can be essential if twodifferent libraries include some of the same instantiations.Example:To create separate instantiation files, enter:cp166 −−one−instantiation−per−object test.ccSection Template Instantiation in chapter Language Implementation.USAGE


<strong>Compiler</strong> Use3−83−−outputOption:−−output fileArguments:An output filename specifying the preprocessing output file.Default:No preprocessing output file is generated.Description:Use file as output filename for the preprocessing output file.Example:To use the file my.pre as the preprocessing output file, enter:cp166 −E −−output my.pre test.cc−−preprocess / −E, −−no−line−commands / −P••••••••


3−84Chapter 3−−pchOption:−−pchDescription:Automatically use and/or create a precompiled header file. For details, seethe Precompiled Headers section in chapter Language Implementation. If−−use−pch or −−create−pch (manual PCH mode) appears on thecommand line following this option, its effect is erased.Example:cp166 −−pch test.cc−−use−pch, −−create−pchSection Precompiled Headers in chapter Language Implementation.USAGE


<strong>Compiler</strong> Use3−85−−pch−dirOption:−−pch−dir dir_nameArguments:The name of the directory to search for and/or create a precompiledheader file.Description:Specify the directory in which to search for and/or create a precompiledheader file. This option may be used with automatic PCH mode (−−pch)or manual PCH mode (−−create−pch or −−use−pch).Example:To use the directory /usr/include/pch to automatically createprecompiled header files, enter:cp166 −−pch−dir /usr/include/pch −−pch test.cc−−pch, −−use−pch, −−create−pchSection Precompiled Headers in chapter Language Implementation.••••••••


3−86Chapter 3−−pch−messagesOption:−−pch−messages−−no−pch−messagesDefault:−−pch−messagesDescription:Enable or disable the display of a message indicating that a precompiledheader file was created or used in the current compilation.Example:cp166 −−create−pch test.pch −−pch−messages test.cc"test.cc": creating precompiled header file "test.pch"−−pch, −−use−pch, −−create−pchSection Precompiled Headers in chapter Language Implementation.USAGE


<strong>Compiler</strong> Use3−87−−pch−verboseOption:−−pch−verboseDescription:In automatic PCH mode, for each precompiled header file that cannot beused for the current compilation, a message is displayed giving the reasonthat the file cannot be used.Example:cp166 −−pch −−pch−verbose test.cc−−pchSection Precompiled Headers in chapter Language Implementation.••••••••


3−88Chapter 3−−pending−instantiationsOption:−−pending−instantiations nArguments:The maximum number of instantiation for a single template.Default:64Description:Specifies the maximum number of instantiations of a given template thatmay be in process of being instantiated at a given time. This is used todetect runaway recursive instantiations. If n is zero, there is no limit.Example:To specify a maximum of 32 pending instantiations, enter:cp166 −−pending−instantiations 32 test.ccSection Template Instantiation in chapter Language Implementation.USAGE


<strong>Compiler</strong> Use3−89−−preprocess / −EOption:−E−−preprocessDescription:Do preprocessing only. Write preprocessed text to the preprocessingoutput file, with comments removed and with line control information.When you use the −E option, use the −−output option to separate theoutput from the header produced by the compiler.Example:cp166 −E −−output preout test.cc−−comments / −C,−−dependencies / −M,−−no−line−commands / −P••••••••


3−90Chapter 3−−remarks / −rOption:−r−−remarksDescription:Issue remarks, which are diagnostic messages even milder than warnings.Example:To enable the display of remarks, enter:cp166 −r test.ccUSAGE


<strong>Compiler</strong> Use3−91−−remove−unneeded−entitiesOption:−−remove−unneeded−entities−−no−remove−unneeded−entitiesDefault:−−remove−unneeded−entitiesDescription:Enable or disable an optimization to remove unneeded entities from thegenerated intermediate C file. Something may be referenced but unneededif it is referenced only by something that is itself unneeded; certainentities, such as global variables and routines defined in the translationunit, are always considered to be needed.Example:cp166 −−no−remove−unneeded−entities test.cc••••••••


3−92Chapter 3−−rttiOption:−−rtti−−no−rttiDefault:−−no−rttiDescription:Enable or disable support for RTTI (run−time type information) features:dynamic_cast, typeid.Example:cp166 −−rtti test.ccUSAGE


<strong>Compiler</strong> Use3−93−−signed−chars / −sOption:−s−−signed−charsDescription:Treat ’character’ type variables as ’signed character’ variables. When plainchar is signed, the macro __SIGNED_CHARS__ is defined.Example:cp166 −s test.cc−−unsigned−chars / −u••••••••


3−94Chapter 3−−special−subscript−costOption:−−special−subscript−cost−−no−special−subscript−costDefault:−−no−special−subscript−costDescription:Enable or disable a special nonstandard weighting of the conversion to theintegral operand of the [] operator in overload resolution.This is a compatibility feature that may be useful with some existing code.The special cost is enabled by default in cfront 3.0 mode. With this featureenabled, the following code compiles without error:struct A {A();operator int *();int operator[](unsigned);};void main() {A a;a[0]; // Ambiguous, but allowed with this option// operator[] is chosen}Example:cp166 −−special−subscript−cost test.ccUSAGE


<strong>Compiler</strong> Use3−95−−strict / −A−−strict−warnings / −aOption:−A / −−strict−a / −−strict−warningsDescription:Enable strict ANSI mode, which provides diagnostic messages whennon−ANSI features are used, and disables features that conflict with ANSI Cor <strong>C++</strong>. ANSI violations can be issued as either warnings or errorsdepending on which command line option is used. The −−strict optionsissue errors and the −−strict−warnings options issue warnings. The errorthreshold is set so that the requested diagnostics will be listed.Example:To enable strict ANSI mode, with error diagnostic messages, enter:cp166 −A test.cc••••••••


3−96Chapter 3−−suppress−typeinfo−varsOption:−−suppress−typeinfo−varsDescription:Suppress the generation of type info variables when run−time type info(RTTI) is disabled. By default only type info variables are generated, noother run−time type info. With this option you can also suppress type infovarables.Example:cp166 −−suppress−typeinfo−vars test.cc−−rttiUSAGE


<strong>Compiler</strong> Use3−97−−suppress−vtblOption:−−suppress−vtblDescription:Suppress definition of virtual function tables in cases where the heuristicused by the <strong>C++</strong> compiler to decide on definition of virtual function tablesprovides no guidance. The virtual function table for a class is defined in acompilation if the compilation contains a definition of the first non−inlinenon−pure virtual function of the class. For classes that contain no suchfunction, the default behavior is to define the virtual function table (but todefine it as a local static entity). The −−suppress−vtbl option suppressesthe definition of the virtual function tables for such classes, and the−−force−vtbl option forces the definition of the virtual function table forsuch classes. −−force−vtbl differs from the default behavior in that it doesnot force the definition to be local.Example:cp166 −−suppress−vtbl test.cc−−force−vtbl••••••••


3−98Chapter 3−−sys−includeOption:−−sys−include directoryArguments:The name of the system include directory to search for include file(s).Description:Change the algorithm for searching system include files whose names donot have an absolute pathname to look in directory.Example:cp166 −−sys−include /proj/include test.ccSection 3.2, Include Files.−−include−directoryUSAGE


<strong>Compiler</strong> Use3−99−−timing / −#Option:−#−−timingDefault:No timing information is generated.Description:Generate compilation timing information. This option causes the compilerto display the amount of CPU time and elapsed time used by each phaseof the compilation and a total for the entire compilation.Example:cp166 −# test.ccprocessed 180 lines at 8102 lines/min••••••••


3−100Chapter 3−−trace−includes / −HOption:−H−−trace−includesDescription:Do preprocessing only. Instead of the normal preprocessing output,generate on the preprocessing output file a list of the names of files#included.Examples:cp166 −H test.cciostream.hstring.h−−preprocess / −E, −−no−line−commands / −PUSAGE


<strong>Compiler</strong> Use3−101−−tsw−diagnosticsOption:−−tsw−diagnostics−−no−tsw−diagnosticsDefault:−−tsw−diagnosticsDescription:Enable or disable a mode in which the error message is given in theTASKING style. So, in the same format as the TASKING C compilermessages.Example:cp166 −−no−tsw−diagnostics test.cc−−brief−diagnosticsChapter <strong>Compiler</strong> Diagnostics and Appendix Error Messages.••••••••


3−102Chapter 3−−typenameOption:−−typename−−no−typenameDefault:−−typenameDescription:Enable or disable recognition of the typename keyword.Example:cp166 −−no−typename test.cc−−implicit−typenameUSAGE


<strong>Compiler</strong> Use3−103−−undefine / −UOption:−Uname−−undefine nameArguments:The name macro you want to undefine.Description:Remove any initial definition of identifier name as in #undef, unless it is apredefined ANSI standard macro. ANSI specifies the following predefinedsymbols to exist, which cannot be removed:__FILE____LINE____TIME____DATE____STDC__"current source filename"current source line number (int type)"hh:mm:ss""Mmm dd yyyy"level of ANSI standard. This macro is set to 1 when theoption to disable language extensions (−A) is effective.Whenever language extensions are excepted, __STDC__ is setto 0 (zero).__cplusplus is defined when compiling a <strong>C++</strong> programWhen cp166 is invoked, also the following predefined symbols exist:c_plusplusis defined in addition to the standard __cplusplus__SIGNED_CHARS__is defined when plain char is signed._WCHAR_T is defined when wchar_t is a keyword._BOOLis defined when bool is a keyword.__ARRAY_OPERATORSis defined when array new and delete are enabled.These symbols can be turned off with the −U option.••••••••


USAGE3−104Chapter 3Example:cp166 −Uc_plusplus test.cc−D / −−define


<strong>Compiler</strong> Use3−105−−unsigned−chars / −uOption:−u−−unsigned−charsDescription:Treat ’character’ type variables as ’unsigned character’ variables.Example:cp166 −u test.cc−−signed−chars / −s••••••••


3−106Chapter 3−−use−pchOption:−−use−pch filenameArguments:The filename to use as a precompiled header file.Description:Use a precompiled header file of the specified name as part of the currentcompilation. If −−pch (automatic PCH mode) or −−create−pch appearson the command line following this option, its effect is erased.Example:To use the precompiled header file with the name test.pch, enter:cp166 −−use−pch test.pch test.cc−−pch, −−create−pchSection Precompiled Headers in chapter Language Implementation.USAGE


<strong>Compiler</strong> Use3−107−−using−stdOption:−−using−std−−no−using−stdDefault:−−using−stdDescription:Enable or disable implicit use of the std namespace when standardheader files are included.Example:cp166 −−using−std test.cc−−namespacesSection Namespace Support in chapter Language Implementation.••••••••


3−108Chapter 3−−variadic−macrosOption:−−variadic−macros−−no−variadic−macrosDefault:−−no−variadic−macrosDescription:Allow or disallow macros with a variable number of arguments.Example:cp166 −−variadic−macros test.cc−−extended−variadic−macrosUSAGE


<strong>Compiler</strong> Use3−109−−version / −V / −vOption:−V−v−−versionDescription:Display version information.Example:cp166 −VTASKING <strong>C166</strong>/<strong>ST10</strong> <strong>C++</strong> compiler vx.yrz Build nnnCopyright years Altium BV Serial# 00000000••••••••


3−110Chapter 3−−wchar_t−keywordOption:−−wchar_t−keyword−−no−wchar_t−keywordDefault:−−wchar_t−keywordDescription:Enable or disable recognition of wchar_t as a keyword.Example:cp166 −−no−wchar_t−keyword test.ccUSAGE


<strong>Compiler</strong> Use3−111−−wrap−diagnosticsOption:−−wrap−diagnostics−−no−wrap−diagnosticsDefault:−−wrap−diagnosticsDescription:Enable or disable a mode in which the error message text is not wrappedwhen too long to fit on a single line.Example:cp166 −−no−wrap−diagnostics test.cc−−brief−diagnosticsChapter <strong>Compiler</strong> Diagnostics and Appendix Error Messages.••••••••


3−112Chapter 3−−xref / −XOption:−Xxfile−−xref xfileArguments:The name of the cross−reference file.Description:Generate cross−reference information in the file xfile. For each referenceto an identifier in the source program, a line of the formsymbol_id name X file−name line−number column−numberis written, where X isD for definition;dfor declaration (that is, a declaration that is not a definition);M for modification;Afor address taken;U for used;CREfor changed (but actually meaning used and modified in a singleoperation, such as an increment);for any other kind of reference, orfor an error in which the kind of reference is indeterminate.symbol−id is a unique decimal number for the symbol. The fields of theabove line are separated by tab characters.USAGE


<strong>Compiler</strong> Use3−1133.2 INCLUDE FILESYou may specify include files in two ways: enclosed in or enclosed in"...". When an #include directive is seen, the following algorithm is used totry to open the include file:1. If the filename is enclosed in "...", and it is not an absolute pathname(does not begin with a ’\’ for PC, or a ’/’ for UNIX), the include file issearched for in the directory of the file containing the #include line. Forexample, in:PC:UNIX:cp166 ..\..\source\test.cccp166 ../../source/test.cccp166 first searches in the directory ..\..\source (../../source forUNIX) for include files.If you compile a source file in the directory where the file is located(cp166 test.cc), the compiler searches for include files in the currentdirectory.This first step is not done for include files enclosed in .2. Use the directories specified with the −I or −−include−directory option,in a left−to−right order. For example:PC:UNIX:cp166 −I..\..\include demo.cccp166 −I../../include demo.cc3. Check if the environment variable CP166INC exists. If it does exist, use thecontents as a directory specifier for include files. You can specify morethan one directory in the environment variable CP166INC by using aseparator character. Instead of using −I as in the example above, you canspecify the same directory using CP166INC:••••••••


3−114Chapter 3PC:set CP166INC=..\..\includecp166 demo.ccUNIX:if using the Bourne shell (sh)CP166INC=../../includeexport CP166INCcp166 demo.ccor if using the C−shell (csh)setenv CP166INC ../../includecp166 demo.cc4. When an include file is not found with the rules mentioned above, thecompiler tries the subdirectories include.cpp and include, onedirectory higher than the directory containing the cp166 binary. Forexample:PC:cp166.exe is installed in the directory C:\<strong>C166</strong>\BINThe directories searched for the include file areC:\<strong>C166</strong>\INCLUDE.CPP and C:\<strong>C166</strong>\INCLUDEUNIX:cp166 is installed in the directory /usr/local/c166/binThe directories searched for the include file are/usr/local/c166/include.cpp and/usr/local/c166/includeThe compiler determines run−time which directory the binary is executedfrom to find this include directory.USAGE5. If the include file is still not found, the directories specified in the−−sys−include option are searched.A directory name specified with the −I option or in CP166INC may or maynot be terminated with a directory separator, because cp166 inserts thisseparator, if omitted.


<strong>Compiler</strong> Use3−115When you specify more than one directory to the environment variableCP166INC, you have to use one of the following separator characters:PC:; , spacee.g.set CP166INC=..\..\include;\proj\includeUNIX:: ; , spacee.g.setenv CP166INC ../../include:/proj/includeIf the include directory is specified as −, e.g., −I−, the option indicates thepoint in the list of −I or −−include−directory options at which the searchfor file names enclosed in should begin. That is, the search for names should only consider directories named in −I or−−include−directory options following the −I−, and the directories ofitems 3 and 4 above. −I− also removes the directory containing the currentinput file (item 1 above) from the search path for file names enclosed in"...".An include directory specified with the −−sys−include option isconsidered a system" include directory. Warnings are suppressed whenprocessing files found in system include directories.If the filename has no suffix it will be searched for by appending each of aset of include file suffixes. When searching in a given directory all of thesuffixes are tried in that directory before moving on to the next searchdirectory. The default set of suffixes is, no extension, .h and .hpp. Thedefault can be overridden using the −−incl−suffixes command lineoption. A null file suffix cannot be used unless it is present in the suffix list(that is, the <strong>C++</strong> compiler will always attempt to add a suffix from thesuffix list when the filename has no suffix).••••••••


3−116Chapter 33.3 PRAGMASAccording to ANSI (3.8.6) a preprocessing directive of the form:#pragma pragma−token−list new−linecauses the compiler to behave in an implementation−defined manner. Thecompiler ignores pragmas which are not mentioned in the list below.Pragmas give directions to the code generator of the compiler. Besides thepragmas there are two other possibilities to steer the code generator:command line options and keywords. The compiler acknowledges thesethree groups using the following rule:Command line options can be overruled by keywords and pragmas.Keywords can be overruled by pragmas. So the pragma has the highestpriority.This approach makes it possible to set a default optimization level for asource module, which can be overridden temporarily within the source bya pragma.cp166 supports the following pragmas and all pragmas that are describedin the C Cross−<strong>Compiler</strong> User’s <strong>Manual</strong>:instantiatedo_not_instantiatecan_instantiateThese are template instantiation pragmas. They are describedin detail in the section Template Instantiation in chapterLanguage Implementation.hdrstopno_pchThese are precompiled header pragmas. They are describedin detail in the section Precompiled Headers in chapterLanguage Implementation.USAGEonceWhen placed at the beginning of a header file, indicates thatthe file is written in such a way that including it several timeshas the same effect as including it once. Thus, if the <strong>C++</strong>compiler sees #pragma once at the start of a header file, itwill skip over it if the file is #included again.A typical idiom is to place an #ifndef guard around the bodyof the file, with a #define of the guard variable after the#ifndef:


<strong>Compiler</strong> Use3−117#pragma once // optional#ifndef FILE_H#define FILE_H... body of the header file ...#endifThe #pragma once is marked as optional in this example,because the <strong>C++</strong> compiler recognizes the #ifndef idiom anddoes the optimization even in its absence. #pragma once isaccepted for compatibility with other compilers and to allowthe programmer to use other guard−code idioms.identThis pragma is given in the form:#pragma ident "string"or:#ident "string"••••••••


3−118Chapter 33.4 COMPILER LIMITSThe ANSI C standard [1−2.2.4] defines a number of translation limits, whicha C compiler must support to conform to the standard. The standard statesthat a compiler implementation should be able to translate and execute aprogram that contains at least one instance of every one of the limits listedbelow. The C compiler’s actual limits are given within parentheses.Most of the actual compiler limits are determined by the amount of freememory in the host system. In this case a ’D’ (Dynamic) is given betweenparentheses. Some limits are determined by the size of the internalcompiler parser stack. These limits are marked with a ’P’. Although the sizeof this stack is 200, the actual limit can be lower and depends on thestructure of the translated program.USAGE• 15 nesting levels of compound statements, iteration controlstructures and selection control structures (P > 15)• 8 nesting levels of conditional inclusion (50)• 12 pointer, array, and function declarators (in any combinations)modifying an arithmetic, a structure, a union, or an incomplete typein a declaration (15)• 31 nesting levels of parenthesized declarators within a fulldeclarator (P > 31)• 32 nesting levels of parenthesized expressions within a fullexpression (P > 32)• 31 significant characters in an external identifier (full ANSI−Cmode),120 significant characters in an external identifier (non ANSI−Cmode)• 511 external identifiers in one translation unit (D)• 127 identifiers with block scope declared in one block (D)• 1024 macro identifiers simultaneously defined in one translation unit(D)• 31 parameters in one function declaration (D)• 31 arguments in one function call (D)• 31 parameters in one macro definition (D)• 31 arguments in one macro call (D)• 509 characters in a logical source line (1500)• 509 characters in a character string literal or wide string literal (afterconcatenation) (1500)


<strong>Compiler</strong> Use3−119• 8 nesting levels for #included files (50)• 257 case labels for a switch statement, excluding those for anynested switch statements (D)• 127 members in a single structure or union (D)• 127 enumeration constants in a single enumeration (D)• 15 levels of nested structure or union definitions in a singlestruct−declaration−list (D)••••••••


USAGE3−120Chapter 3


CHAPTERCOMPILERDIAGNOSTICS4


DIAGNOSTICS4−2Chapter 4CHAPTER4


<strong>Compiler</strong> Diagnostics4−34.1 DIAGNOSTIC MESSAGESDiagnostic messages have an associated severity, as follows:• Catastrophic errors, also called ’fatal errors’, indicate problems ofsuch severity that the compilation cannot continue. For example:command−line errors, internal errors, and missing include files. Ifmultiple source files are being compiled, any source files after thecurrent one will not be compiled.• Errors indicate violations of the syntax or semantic rules of the <strong>C++</strong>language. Compilation continues, but object code is not generated.• Warnings indicate something valid but questionable. Compilationcontinues and object code is generated (if no errors are detected).• Remarks indicate something that is valid and probably intended, butwhich a careful programmer may want to check. These diagnosticsare not issued by default. Compilation continues and object code isgenerated (if no errors are detected).• The last class of messages are the internal compiler errors. Theseerrors are caused by failed internal consistency checks and shouldnever occur. However, if such a ’SYSTEM’ error appears, pleasereport the occurrence to TASKING, using a Problem Report form.Please include a diskette or tape, containing a small <strong>C++</strong> programcausing the error.By default, −−tsw−diagnostics, diagnostics are written to stderr with aform like the following:test.cc5: break;E 116: a break statement may only be used within a loop or switchWith the command line option −−no−tsw−diagnostics the messageappear in the following form:"test.cc", line 5: a break statement may only be used within a loopor switchbreak;^Note that the message identifies the file and line involved, and that thesource line itself (with position indicated by the ^) follows the message. Ifthere are several diagnostics in one source line, each diagnostic will havethe form above, with the result that the text of the source line will bedisplayed several times, with an appropriate position each time.••••••••


4−4Chapter 4Long messages are wrapped to additional lines when necessary.A configuration flag controls whether or not the string error: appears, i.e.,the <strong>C++</strong> compiler can be configured so that the severity string is omittedwhen the severity is error.The command line option −−brief−diagnostics may be used to request ashorter form of the diagnostic output in which the original source line isnot displayed and the error message text is not wrapped when too long tofit on a single line.The command line option −−display−error−number may be used torequest that the error number be included in the diagnostic message.When displayed, the error number also indicates whether the error mayhave its severity overridden on the command line (with one of the−−diag−severity options). If the severity may be overridden, the errornumber will include the suffix −D (for discretionary); otherwise no suffixwill be present."Test_name.cc", line 7: error #64−D: declaration does notdeclare anythingstruct ;^"Test_name.cc", line 9: error #77: this declaration has no storageclass or type specifierxxxxx;^DIAGNOSTICSBecause an error is determined to be discretionary based on the errorseverity associated with a specific context, a given error may bediscretionary in some cases and not in others.For some messages, a list of entities is useful; they are listed following theinitial error message:"test.cc", line 4: error: more than one instance of overloadedfunction "f" matches the argument list:function "f(int)"function "f(float)"argument types are: (double)f(1.5);^In some cases, some additional context information is provided;specifically, such context information is useful when the <strong>C++</strong> compilerissues a diagnostic while doing a template instantiation or while generatinga constructor, destructor, or assignment operator function. For example:


<strong>Compiler</strong> Diagnostics4−5"test.cc", line 7: error: "A::A()" is inaccessibleB x;^detected during implicit generation of "B::B()" at line 7Without the context information, it is very hard to figure out what the errorrefers to.For a list of error messages and error numbers, see Appendix A, ErrorMessages.4.2 TERMINATION MESSAGEScp166 writes sign−off messages to stderr if errors are detected. Forexample, one of the following forms of messagen errors detected in the compilation of "ifile".1 catastrophic error detected in the compilation of "ifile".n errors and 1 catastrophic error detected in the compilation of"ifile".is written to indicate the detection of errors in the compilation. Nomessage is written if no errors were detected. The following messageError limit reached.is written when the count of errors reaches the error limit (see the −eoption); compilation is then terminated. The messageCompilation terminated.is written at the end of a compilation that was prematurely terminatedbecause of a catastrophic error. The messageCompilation abortedis written at the end of a compilation that was prematurely terminatedbecause of an internal error. Such an error indicates an internal problem inthe compiler. If such an internal error appears, please report theoccurrence to TASKING, using a Problem Report form. Please include adiskette or tape, containing a small <strong>C++</strong> program causing the error.••••••••


4−6Chapter 44.3 RESPONSE TO SIGNALSThe signals SIGINT (caused by a user interrupt, like ^C) and SIGTERM(caused by a kill command) are trapped by the <strong>C++</strong> compiler and causeabnormal termination.4.4 RETURN VALUEScp166 returns an exit status to the operating system environment fortesting.For example,in a PC BATCH−file you can examine the exit status of the programexecuted with ERRORLEVEL:cp166 %1.ccIF ERRORLEVEL 1 GOTO STOP_BATCHIn a Bourne shell script, the exit status can be found in the $? variable, forexample:cp166 $*case $? in0) echo ok ;;2|4) echo error ;;esacDIAGNOSTICSThe exit status of cp166 indicates the highest severity diagnostic detectedand is one of the numbers of the following list:−1 Abnormal termination0 Compilation successful, no errors, maybe some remarks0 There were warnings2 There were user errors, but terminated normally4 A catastrophic error, premature ending


APPENDIXERROR MESSAGESA


ERRORSA−2APPENDIXAppendix AA


Error MessagesA−31 INTRODUCTIONThis appendix lists all diagnostic messages, starting with the error numberand the error tag name, followed by the message itself. The error numberand/or error tag can be used in −−diag−severity options to override thenormal error severity.The <strong>C++</strong> compiler produces error messages on standard error output. Withthe −−error−output option you can redirect the error messages to anerror list file.Normally, diagnostics are written to stderr in the following form(TASKING layout):severity #err_num: messageThe severity can be one of: R (remark), W (warning), E (error), F (fatalerror), S (internal error).With −−no−tsw−diagnostics, diagnostics are written to stderr in thefollowing form:"filename", line line_num: messageWith −−display−error−number this form will be:or:"filename", line line_num: severity #err_num: message"filename", line line_num: severity #err_num−D: messageWhere severity can be one of: remark, warning, error, catastrophic error,command−line error or internal error.If the severity may be overridden, the error number will include the suffix−D (for discretionary); otherwise no suffix will be present.In a raw listing file (−L option) diagnostic messages have the followinglayout, starting with the severity (R: remark, W: warning, E: error, C:catastrophe):[R|W|E|C] "filename" line_number column_number error_messageFor more detailed information see chapter <strong>Compiler</strong> Diagnostics.All diagnostic messages are listed below.••••••••


A−4Appendix A2 MESSAGES0001 last_line_incomplete:last line of file ends without a newline0002 last_line_backslash:last line of file ends with a backslash0003 include_recursion:#include file "xxxx" includes itself0004 out_of_memory:out of memory0005 source_file_could_not_be_opened:could not open source file "xxxx"0006 comment_unclosed_at_eof:comment unclosed at end of file0007 bad_token:unrecognized token0008 unclosed_string:missing closing quote0009 nested_comment:nested comment is not allowed0010 bad_use_of_sharp:"#" not expected hereERRORS0011 bad_pp_directive_keyword:unrecognized preprocessing directive0012 end_of_flush:parsing restarts here after previous syntax error0013 exp_file_name:expected a file name


Error MessagesA−50014 extra_text_in_pp_directive:extra text after expected end of preprocessing directive0016 illegal_source_file_name:"xxxx" is not a valid source file name0017 exp_rbracket:expected a "]"0018 exp_rparen:expected a ")"0019 extra_chars_on_number:extra text after expected end of number0020 undefined_identifier:identifier "xxxx" is undefined0021 useless_type_qualifiers:type qualifiers are meaningless in this declaration0022 bad_hex_digit:invalid hexadecimal number0023 integer_too_large:integer constant is too large0024 bad_octal_digit:invalid octal digit0025 zero_length_string:quoted string should contain at least one character0026 too_many_characters:too many characters in character constant0027 bad_character_value:character value is out of range0028 expr_not_constant:expression must have a constant value••••••••


A−6Appendix A0029 exp_primary_expr:expected an expression0030 bad_float_value:floating constant is out of range0031 expr_not_integral:expression must have integral type0032 expr_not_arithmetic:expression must have arithmetic type0033 exp_line_number:expected a line number0034 bad_line_number:invalid line number0035 error_directive:#error directive: xxxx0036 missing_pp_if:the #if for this directive is missing0037 missing_endif:the #endif for this directive is missing0038 pp_else_already_appeared:directive is not allowed −− an #else has already appeared0039 divide_by_zero:division by zeroERRORS0040 exp_identifier:expected an identifier0041 expr_not_scalar:expression must have arithmetic or pointer type0042 incompatible_operands:operand types are incompatible ("type" and "type")


Error MessagesA−70044 expr_not_pointer:expression must have pointer type0045 cannot_undef_predef_macro:#undef may not be used on this predefined name0046 cannot_redef_predef_macro:this predefined name may not be redefined0047 bad_macro_redef:incompatible redefinition of macro "entity" (declared at line xxxx)0049 duplicate_macro_param_name:duplicate macro parameter name0050 paste_cannot_be_first:"##" may not be first in a macro definition0051 paste_cannot_be_last:"##" may not be last in a macro definition0052 exp_macro_param:expected a macro parameter name0053 exp_colon:expected a ":"0054 too_few_macro_args:too few arguments in macro invocation0055 too_many_macro_args:too many arguments in macro invocation0056 sizeof_function:operand of sizeof may not be a function0057 bad_constant_operator:this operator is not allowed in a constant expression0058 bad_pp_operator:this operator is not allowed in a preprocessing expression••••••••


A−8Appendix A0059 bad_constant_function_call:function call is not allowed in a constant expression0060 bad_integral_operator:this operator is not allowed in an integral constant expression0061 integer_overflow:integer operation result is out of range0062 negative_shift_count:shift count is negative0063 shift_count_too_large:shift count is too large0064 useless_decl:declaration does not declare anything0065 exp_semicolon:expected a ";"0066 enum_value_out_of_int_range:enumeration value is out of "int" range0067 exp_rbrace:expected a "}"0068 integer_sign_change:integer conversion resulted in a change of sign0069 integer_truncated:integer conversion resulted in truncationERRORS0070 incomplete_type_not_allowed:incomplete type is not allowed0071 sizeof_bit_field:operand of sizeof may not be a bit field0075 bad_indirection_operand:operand of "*" must be a pointer


Error MessagesA−90076 empty_macro_argument:argument to macro is empty0077 missing_decl_specifiers:this declaration has no storage class or type specifier0078 initializer_in_param:a parameter declaration may not have an initializer0079 exp_type_specifier:expected a type specifier0080 storage_class_not_allowed:a storage class may not be specified here0081 mult_storage_classes:more than one storage class may not be specified0082 storage_class_not_first:storage class is not first0083 dupl_type_qualifier:type qualifier specified more than once0084 bad_combination_of_type_specifiers:invalid combination of type specifiers0085 bad_param_storage_class:invalid storage class for a parameter0086 bad_function_storage_class:invalid storage class for a function0087 type_specifier_not_allowed:a type specifier may not be used here0088 array_of_function:array of functions is not allowed0089 array_of_void:array of void is not allowed••••••••


A−10Appendix A0090 function_returning_function:function returning function is not allowed0091 function_returning_array:function returning array is not allowed0092 param_id_list_needs_function_def:identifier−list parameters may only be used in a function definition0093 function_type_must_come_from_declarator:function type may not come from a typedef0094 array_size_must_be_positive:the size of an array must be greater than zero0095 array_size_too_large:array is too large0096 empty_translation_unit:a translation unit must contain at least one declaration0097 bad_function_return_type:a function may not return a value of this type0098 bad_array_element_type:an array may not have elements of this type0099 decl_should_be_of_param:a declaration here must declare a parameter0100 dupl_param_name:duplicate parameter nameERRORS0101 id_already_declared:"xxxx" has already been declared in the current scope0102 nonstd_forward_decl_enum:forward declaration of enum type is nonstandard0103 class_too_large:class is too large


Error MessagesA−110104 struct_too_large:struct or union is too large0105 bad_bit_field_size:invalid size for bit field0106 bad_bit_field_type:invalid type for a bit field0107 zero_length_bit_field_must_be_unnamed:zero−length bit field must be unnamed0108 signed_one_bit_field:signed bit field of length 10109 expr_not_ptr_to_function:expression must have (pointer−to−) function type0110 exp_definition_of_tag:expected either a definition or a tag name0111 code_is_unreachable:statement is unreachable0112 exp_while:expected "while"0114 never_defined:entity−kind "entity" was referenced but not defined0115 continue_must_be_in_loop:a continue statement may only be used within a loop0116 break_must_be_in_loop_or_switch:a break statement may only be used within a loop or switch0117 no_value_returned_in_non_void_function:non−void entity−kind "entity" (declared at line xxxx) should returna value••••••••


A−12Appendix A0118 value_returned_in_void_function:a void function may not return a value0119 cast_to_bad_type:cast to type "type" is not allowed0120 bad_return_value_type:return value type does not match the function type0121 case_label_must_be_in_switch:a case label may only be used within a switch0122 default_label_must_be_in_switch:a default label may only be used within a switch0123 case_label_appears_more_than_once:case label value has already appeared in this switch0124 default_label_appears_more_than_once:default label has already appeared in this switch0125 exp_lparen:expected a "("0126 expr_not_an_lvalue:expression must be an lvalue0127 exp_statement:expected a statement0128 loop_not_reachable:loop is not reachable from preceding codeERRORS0129 block_scope_function_must_be_extern:a block−scope function may only have extern storage class0130 exp_lbrace:expected a "{"0131 expr_not_ptr_to_class:expression must have pointer−to−class type


Error MessagesA−130132 expr_not_ptr_to_struct_or_union:expression must have pointer−to−struct−or−union type0133 exp_member_name:expected a member name0134 exp_field_name:expected a field name0135 not_a_member:entity−kind "entity" has no member "xxxx"0136 not_a_field:entity−kind "entity" has no field "xxxx"0137 expr_not_a_modifiable_lvalue:expression must be a modifiable lvalue0138 address_of_register_variable:taking the address of a register variable is not allowed0139 address_of_bit_field:taking the address of a bit field is not allowed0140 too_many_arguments:too many arguments in function call0141 all_proto_params_must_be_named:unnamed prototyped parameters not allowed when body is present0142 expr_not_pointer_to_object:expression must have pointer−to−object type0143 program_too_large:program too large or complicated to compile0144 bad_initializer_type:a value of type "type" cannot be used to initialize an entity of type"type"••••••••


A−14Appendix A0145 cannot_initialize:entity−kind "entity" may not be initialized0146 too_many_initializer_values:too many initializer values0147 not_compatible_with_previous_decl:declaration is incompatible with entity−kind "entity" (declared atline xxxx)0148 already_initialized:entity−kind "entity" has already been initialized0149 bad_file_scope_storage_class:a global−scope declaration may not have this storage class0150 type_cannot_be_param_name:a type name may not be redeclared as a parameter0151 typedef_cannot_be_param_name:a typedef name may not be redeclared as a parameter0152 non_zero_int_conv_to_pointer:conversion of nonzero integer to pointer0153 expr_not_class:expression must have class type0154 expr_not_struct_or_union:expression must have struct or union typeERRORS0155 old_fashioned_assignment_operator:old−fashioned assignment operator0156 old_fashioned_initializer:old−fashioned initializer0157 expr_not_integral_constant:expression must be an integral constant expression


Error MessagesA−150158 expr_not_an_lvalue_or_function_designator:expression must be an lvalue or a function designator0159 decl_incompatible_with_previous_use:declaration is incompatible with previous "entity" (declared at linexxxx)0160 external_name_clash:name conflicts with previously used external name "xxxx"0161 unrecognized_pragma:unrecognized #pragma0163 cannot_open_temp_file:could not open temporary file "xxxx"0164 temp_file_dir_name_too_long:name of directory for temporary files is too long ("xxxx")0165 too_few_arguments:too few arguments in function call0166 bad_float_constant:invalid floating constant0167 incompatible_param:argument of type "type" is incompatible with parameter of type"type"0168 function_type_not_allowed:a function type is not allowed here0169 exp_declaration:expected a declaration0170 pointer_outside_base_object:pointer points outside of underlying object0171 bad_cast:invalid type conversion••••••••


A−16Appendix A0172 linkage_conflict:external/internal linkage conflict with previous declaration0173 float_to_integer_conversion:floating−point value does not fit in required integral type0174 expr_has_no_effect:expression has no effect0175 subscript_out_of_range:subscript out of range0177 declared_but_not_referenced:entity−kind "entity" was declared but never referenced0178 pcc_address_of_array:"&" applied to an array has no effect0179 mod_by_zero:right operand of "%" is zero0180 old_style_incompatible_param:argument is incompatible with formal parameter0181 printf_arg_mismatch:argument is incompatible with corresponding format stringconversion0182 empty_include_search_path:could not open source file "xxxx" (no directories in search list)ERRORS0183 cast_not_integral:type of cast must be integral0184 cast_not_scalar:type of cast must be arithmetic or pointer0185 initialization_not_reachable:dynamic initialization in unreachable code


Error MessagesA−170186 unsigned_compare_with_zero:pointless comparison of unsigned integer with zero0187 assign_where_compare_meant:use of "=" where "==" may have been intended0188 mixed_enum_type:enumerated type mixed with another type0189 file_write_error:error while writing xxxx file0190 bad_il_file:invalid intermediate language file0191 cast_to_qualified_type:type qualifier is meaningless on cast type0192 unrecognized_char_escape:unrecognized character escape sequence0193 undefined_preproc_id:zero used for undefined preprocessing identifier0194 exp_asm_string:expected an asm string0195 asm_func_must_be_prototyped:an asm function must be prototyped0196 bad_asm_func_ellipsis:an asm function may not have an ellipsis0219 file_delete_error:error while deleting file "xxxx"0220 integer_to_float_conversion:integral value does not fit in required floating−point type0221 float_to_float_conversion:floating−point value does not fit in required floating−point type••••••••


A−18Appendix A0222 bad_float_operation_result:floating−point operation result is out of range0223 implicit_func_decl:function declared implicitly0224 too_few_printf_args:the format string requires additional arguments0225 too_many_printf_args:the format string ends before this argument0226 bad_printf_format_string:invalid format string conversion0227 macro_recursion:macro recursion0228 nonstd_extra_comma:trailing comma is nonstandard0229 enum_bit_field_too_small:bit field cannot contain all values of the enumerated type0230 nonstd_bit_field_type:nonstandard type for a bit field0231 decl_in_prototype_scope:declaration is not visible outside of function0232 decl_of_void_ignored:old−fashioned typedef of "void" ignoredERRORS0233 old_fashioned_field_selection:left operand is not a struct or union containing this field0234 old_fashioned_ptr_field_selection:pointer does not point to struct or union containing this field0235 var_retained_incomp_type:variable "xxxx" was declared with a never−completed type


Error MessagesA−190236 boolean_controlling_expr_is_constant:controlling expression is constant0237 switch_selector_expr_is_constant:selector expression is constant0238 bad_param_specifier:invalid specifier on a parameter0239 bad_specifier_outside_class_decl:invalid specifier outside a class declaration0240 dupl_decl_specifier:duplicate specifier in declaration0241 base_class_not_allowed_for_union:a union is not allowed to have a base class0242 access_already_specified:multiple access control specifiers are not allowed0243 missing_class_definition:class or struct definition is missing0244 name_not_member_of_class_or_base_classes:qualified name is not a member of class "type" or its base classes0245 member_ref_requires_object:a nonstatic member reference must be relative to a specific object0246 nonstatic_member_def_not_allowed:a nonstatic data member may not be defined outside its class0247 already_defined:entity−kind "entity" has already been defined0248 pointer_to_reference:pointer to reference is not allowed0249 reference_to_reference:reference to reference is not allowed••••••••


A−20Appendix A0250 reference_to_void:reference to void is not allowed0251 array_of_reference:array of reference is not allowed0252 missing_initializer_on_reference:reference entity−kind "entity" requires an initializer0253 exp_comma:expected a ","0254 type_identifier_not_allowed:type name is not allowed0255 type_definition_not_allowed:type definition is not allowed0256 bad_type_name_redeclaration:invalid redeclaration of type name "entity" (declared at line xxxx)0257 missing_initializer_on_const:const entity−kind "entity" requires an initializer0258 this_used_incorrectly:"this" may only be used inside a nonstatic member function0259 constant_value_not_known:constant value is not known0260 missing_type_specifier:explicit type is missing ("int" assumed)ERRORS0261 missing_access_specifier:access control not specified ("xxxx" by default)0262 not_a_class_or_struct_name:not a class or struct name0263 dupl_base_class_name:duplicate base class name


Error MessagesA−210264 bad_base_class:invalid base class0265 no_access_to_name:entity−kind "entity" is inaccessible0266 ambiguous_name:"entity" is ambiguous0267 old_style_parameter_list:old−style parameter list (anachronism)0268 declaration_after_statements:declaration may not appear after executable statement in block0269 inaccessible_base_class:implicit conversion to inaccessible base class "type" is not allowed0274 improperly_terminated_macro_call:improperly terminated macro invocation0276 id_must_be_class_or_namespace_name:name followed by "::" must be a class or namespace name0277 bad_friend_decl:invalid friend declaration0278 value_returned_in_constructor:a constructor or destructor may not return a value0279 bad_destructor_decl:invalid destructor declaration0280 class_and_member_name_conflict:invalid declaration of a member with the same name as its class0281 global_qualifier_not_allowed:global−scope qualifier (leading "::") is not allowed0282 name_not_found_in_file_scope:the global scope has no "xxxx"••••••••


A−22Appendix A0283 qualified_name_not_allowed:qualified name is not allowed0284 null_reference:NULL reference is not allowed0285 brace_initialization_not_allowed:initialization with "{...}" is not allowed for object of type "type"0286 ambiguous_base_class:base class "type" is ambiguous0287 ambiguous_derived_class:derived class "type" contains more than one instance of class "type"0288 derived_class_from_virtual_base:cannot convert pointer to base class "type" to pointer to derivedclass "type" −− base class is virtual0289 no_matching_constructor:no instance of constructor "entity" matches the argument list0290 ambiguous_copy_constructor:copy constructor for class "type" is ambiguous0291 no_default_constructor:no default constructor exists for class "type"0292 not_a_field_or_base_class:"xxxx" is not a nonstatic data member or base class of class "type"ERRORS0293 indirect_nonvirtual_base_class_not_allowed:indirect nonvirtual base class is not allowed0294 bad_union_field:invalid union member −− class "type" has a disallowed memberfunction0296 bad_rvalue_array:invalid use of non−lvalue array


Error MessagesA−230297 exp_operator:expected an operator0298 inherited_member_not_allowed:inherited member is not allowed0299 indeterminate_overloaded_function:cannot determine which instance of entity−kind "entity" is intended0300 bound_function_must_be_called:a pointer to a bound function may only be used to call the function0301 duplicate_typedef:typedef name has already been declared (with same type)0302 function_redefinition:entity−kind "entity" has already been defined0304 no_matching_function:no instance of entity−kind "entity" matches the argument list0305 type_def_not_allowed_in_func_type_decl:type definition is not allowed in function return type declaration0306 default_arg_not_at_end:default argument not at end of parameter list0307 default_arg_already_defined:redefinition of default argument0308 ambiguous_overloaded_function:more than one instance of entity−kind "entity" matches theargument list:0309 ambiguous_constructor:more than one instance of constructor "entity" matches theargument list:0310 bad_default_arg_type:default argument of type "type" is incompatible with parameter oftype "type"••••••••


A−24Appendix A0311 return_type_cannot_distinguish_functions:cannot overload functions distinguished by return type alone0312 no_user_defined_conversion:no suitable user−defined conversion from "type" to "type" exists0313 function_qualifier_not_allowed:type qualifier is not allowed on this function0314 virtual_static_not_allowed:only nonstatic member functions may be virtual0315 unqual_function_with_qual_object:the object has type qualifiers that are not compatible with themember function0316 too_many_virtual_functions:program too large to compile (too many virtual functions)0317 bad_return_type_on_virtual_function_override:return type is not identical to nor covariant with return type "type"of overridden virtual function entity−kind "entity"0318 ambiguous_virtual_function_override:override of virtual entity−kind "entity" is ambiguous0319 pure_specifier_on_nonvirtual_function:pure specifier ("= 0") allowed only on virtual functions0320 bad_pure_specifier:badly−formed pure specifier (only "= 0" is allowed)ERRORS0321 bad_data_member_initialization:data member initializer is not allowed0322 abstract_class_object_not_allowed:object of abstract class type "type" is not allowed:0323 function_returning_abstract_class:function returning abstract class "type" is not allowed:


Error MessagesA−250324 duplicate_friend_decl:duplicate friend declaration0325 inline_and_nonfunction:inline specifier allowed on function declarations only0326 inline_not_allowed:"inline" is not allowed0327 bad_storage_class_with_inline:invalid storage class for an inline function0328 bad_member_storage_class:invalid storage class for a class member0329 local_class_function_def_missing:local class member entity−kind "entity" requires a definition0330 inaccessible_special_function:entity−kind "entity" is inaccessible0332 missing_const_copy_constructor:class "type" has no copy constructor to copy a const object0333 definition_of_implicitly_declared_function:defining an implicitly declared member function is not allowed0334 no_suitable_copy_constructor:class "type" has no suitable copy constructor0335 linkage_specifier_not_allowed:linkage specification is not allowed0336 bad_linkage_specifier:unknown external linkage specification0337 incompatible_linkage_specifier:linkage specification is incompatible with previous "entity"(declared at line xxxx)••••••••


A−26Appendix A0338 overloaded_function_linkage:more than one instance of overloaded function "entity" has "C"linkage0339 ambiguous_default_constructor:class "type" has more than one default constructor0340 temp_used_for_ref_init:value copied to temporary, reference to temporary used0341 nonmember_operator_not_allowed:"operatorxxxx" must be a member function0342 static_member_operator_not_allowed:operator may not be a static member function0343 too_many_args_for_conversion:no arguments allowed on user−defined conversion0344 too_many_args_for_operator:too many parameters for this operator function0345 too_few_args_for_operator:too few parameters for this operator function0346 no_params_with_class_type:nonmember operator requires a parameter with class type0347 default_arg_expr_not_allowed:default argument is not allowedERRORS0348 ambiguous_user_defined_conversion:more than one user−defined conversion from "type" to "type"applies:0349 no_matching_operator_function:no operator "xxxx" matches these operands0350 ambiguous_operator_function:more than one operator "xxxx" matches these operands:


Error MessagesA−270351 bad_arg_type_for_operator_new:first parameter of allocation function must be of type "size_t"0352 bad_return_type_for_op_new:allocation function requires "void *" return type0353 bad_return_type_for_op_delete:deallocation function requires "void" return type0354 bad_first_arg_type_for_operator_delete:first parameter of deallocation function must be of type "void *"0356 type_must_be_object_type:type must be an object type0357 base_class_already_initialized:base class "type" has already been initialized0358 base_class_init_anachronism:base class name required −− "type" assumed (anachronism)0359 member_already_initialized:entity−kind "entity" has already been initialized0360 missing_base_class_or_member_name:name of member or base class is missing0361 assignment_to_this:assignment to "this" (anachronism)0362 overload_anachronism:"overload" keyword used (anachronism)0363 anon_union_member_access:invalid anonymous union −− nonpublic member is not allowed0364 anon_union_member_function:invalid anonymous union −− member function is not allowed••••••••


A−28Appendix A0365 anon_union_storage_class:anonymous union at global or namespace scope must be declaredstatic0366 missing_initializer_on_fields:entity−kind "entity" provides no initializer for:0367 cannot_initialize_fields:implicitly generated constructor for class "type" cannot initialize:0368 no_ctor_but_const_or_ref_member:entity−kind "entity" defines no constructor to initialize thefollowing:0369 var_with_uninitialized_member:entity−kind "entity" has an uninitialized const or reference member0370 var_with_uninitialized_field:entity−kind "entity" has an uninitialized const field0371 missing_const_assignment_operator:class "type" has no assignment operator to copy a const object0372 no_suitable_assignment_operator:class "type" has no suitable assignment operator0373 ambiguous_assignment_operator:ambiguous assignment operator for class "type"0375 missing_typedef_name:declaration requires a typedef nameERRORS0377 virtual_not_allowed:"virtual" is not allowed0378 static_not_allowed:"static" is not allowed0379 bound_function_cast_anachronism:cast of bound function to normal function pointer (anachronism)


Error MessagesA−290380 expr_not_ptr_to_member:expression must have pointer−to−member type0381 extra_semicolon:extra ";" ignored0382 nonstd_const_member:nonstandard member constant declaration (standard form is a staticconst integral member)0384 no_matching_new_function:no instance of overloaded "entity" matches the argument list0386 no_match_for_addr_of_overloaded_function:no instance of entity−kind "entity" matches the required type0387 delete_count_anachronism:delete array size expression used (anachronism)0388 bad_return_type_for_op_arrow:"operator−>" for class "type" returns invalid type "type"0389 cast_to_abstract_class:a cast to abstract class "type" is not allowed:0390 bad_use_of_main:function "main" may not be called or have its address taken0391 initializer_not_allowed_on_array_new:a new−initializer may not be specified for an array0392 member_function_redecl_outside_class:member function "entity" may not be redeclared outside its class0393 ptr_to_incomplete_class_type_not_allowed:pointer to incomplete class type is not allowed0394 ref_to_nested_function_var:reference to local variable of enclosing function is not allowed••••••••


A−30Appendix A0395 single_arg_postfix_incr_decr_anachronism:single−argument function used for postfix "xxxx" (anachronism)0397 bad_default_assignment:implicitly generated assignment operator cannot copy:0398 nonstd_array_cast:cast to array type is nonstandard (treated as cast to "type")0399 class_with_op_new_but_no_op_delete:entity−kind "entity" has an operator newxxxx() but no defaultoperator deletexxxx()0400 class_with_op_delete_but_no_op_new:entity−kind "entity" has a default operator deletexxxx() but nooperator newxxxx()0401 base_class_with_nonvirtual_dtor:destructor for base class "type" is not virtual0403 member_function_redeclaration:entity−kind "entity" has already been declared0404 inline_main:function "main" may not be declared inline0405 class_and_member_function_name_conflict:member function with the same name as its class must be aconstructor0406 nested_class_anachronism:using nested entity−kind "entity" (anachronism)ERRORS0407 too_many_params_for_destructor:a destructor may not have parameters0408 bad_constructor_param:copy constructor for class "type" may not have a parameter of type"type"


Error MessagesA−310409 incomplete_function_return_type:entity−kind "entity" returns incomplete type "type"0410 protected_access_problem:protected entity−kind "entity" is not accessible through a "type"pointer or object0411 param_not_allowed:a parameter is not allowed0412 asm_decl_not_allowed:an "asm" declaration is not allowed here0413 no_conversion_function:no suitable conversion function from "type" to "type" exists0414 delete_of_incomplete_class:delete of pointer to incomplete class0415 no_constructor_for_conversion:no suitable constructor exists to convert from "type" to "type"0416 ambiguous_constructor_for_conversion:more than one constructor applies to convert from "type" to "type":0417 ambiguous_conversion_function:more than one conversion function from "type" to "type" applies:0418 ambiguous_conversion_to_builtin:more than one conversion function from "type" to a built−in typeapplies:0424 addr_of_constructor_or_destructor:a constructor or destructor may not have its address taken0425 dollar_used_in_identifier:dollar sign ("$") used in identifier0426 nonconst_ref_init_anachronism:temporary used for initial value of reference to non−const(anachronism)••••••••


A−32Appendix A0427 qualifier_in_member_declaration:qualified name is not allowed in member declaration0428 mixed_enum_type_anachronism:enumerated type mixed with another type (anachronism)0429 new_array_size_must_be_nonnegative:the size of an array in "new" must be non−negative0430 return_ref_init_requires_temp:returning reference to local temporary0432 enum_not_allowed:"enum" declaration is not allowed0433 qualifier_dropped_in_ref_init:qualifiers dropped in binding reference of type "type" to initializerof type "type"0434 bad_nonconst_ref_init:a reference of type "type" (not const−qualified) cannot be initializedwith a value of type "type"0435 delete_of_function_pointer:a pointer to function may not be deleted0436 bad_conversion_function_decl:conversion function must be a nonstatic member function0437 bad_template_declaration_scope:template declaration is not allowed hereERRORS0438 exp_lt:expected a ""0440 missing_template_param:template parameter declaration is missing


Error MessagesA−330441 missing_template_arg_list:argument list for entity−kind "entity" is missing0442 too_few_template_args:too few arguments for entity−kind "entity"0443 too_many_template_args:too many arguments for entity−kind "entity"0445 not_used_in_template_function_params:entity−kind "entity" is not used in declaring the parameter types ofentity−kind "entity"0446 cfront_multiple_nested_types:two nested types have the same name: "entity" and "entity"(declared at line xxxx) (cfront compatibility)0447 cfront_global_defined_after_nested_type:global "entity" was declared after nested "entity" (declared at linexxxx) (cfront compatibility)0449 ambiguous_ptr_to_overloaded_function:more than one instance of entity−kind "entity" matches the requiredtype0450 nonstd_long_long:the type "long long" is nonstandard0451 nonstd_friend_decl:omission of "xxxx" is nonstandard0452 return_type_on_conversion_function:return type may not be specified on a conversion function0456 runaway_recursive_instantiation:excessive recursion at instantiation of entity−kind "entity"0457 bad_template_declaration:"xxxx" is not a function or static data member••••••••


A−34Appendix A0458 bad_nontype_template_arg:argument of type "type" is incompatible with template parameter oftype "type"0459 init_needing_temp_not_allowed:initialization requiring a temporary or conversion is not allowed0460 decl_hides_function_parameter:declaration of "xxxx" hides function parameter0461 nonconst_ref_init_from_rvalue:initial value of reference to non−const must be an lvalue0463 template_not_allowed:"template" is not allowed0464 not_a_class_template:"type" is not a class template0466 function_template_named_main:"main" is not a valid name for a function template0467 union_nonunion_mismatch:invalid reference to entity−kind "entity" (union/nonunion mismatch)0468 local_type_in_template_arg:a template argument may not reference a local type0469 tag_kind_incompatible_with_declaration:tag kind of xxxx is incompatible with declaration of entity−kind"entity" (declared at line xxxx)ERRORS0470 name_not_tag_in_file_scope:the global scope has no tag named "xxxx"0471 not_a_tag_member:entity−kind "entity" has no tag member named "xxxx"0472 ptr_to_member_typedef:member function typedef (allowed for cfront compatibility)


Error MessagesA−350473 bad_use_of_member_function_typedef:entity−kind "entity" may be used only in pointer−to−memberdeclaration0475 nonexternal_entity_in_template_arg:a template argument may not reference a non−external entity0476 id_must_be_class_or_type_name:name followed by "::~" must be a class name or a type name0477 destructor_name_mismatch:destructor name does not match name of class "type"0478 destructor_type_mismatch:type used as destructor name does not match type "type"0479 called_function_redeclared_inline:entity−kind "entity" redeclared "inline" after being called0481 bad_storage_class_on_template_decl:invalid storage class for a template declaration0482 no_access_to_type_cfront_mode:entity−kind "entity" is an inaccessible type (allowed for cfrontcompatibility)0484 invalid_instantiation_argument:invalid explicit instantiation declaration0485 not_instantiatable_entity:entity−kind "entity" is not an entity that can be instantiated0486 compiler_generated_function_cannot_be_instantiated:compiler generated entity−kind "entity" cannot be explicitlyinstantiated0487 inline_function_cannot_be_instantiated:inline entity−kind "entity" cannot be explicitly instantiated0488 pure_virtual_function_cannot_be_instantiated:pure virtual entity−kind "entity" cannot be explicitly instantiated••••••••


A−36Appendix A0489 instantiation_requested_no_definition_supplied:entity−kind "entity" cannot be instantiated −− no template definitionwas supplied0490 instantiation_requested_and_specialized:entity−kind "entity" cannot be instantiated −− it has been explicitlyspecialized0491 no_constructor:class "type" has no constructor0493 no_match_for_type_of_overloaded_function:no instance of entity−kind "entity" matches the specified type0494 nonstd_void_param_list:declaring a void parameter list with a typedef is nonstandard0495 cfront_name_lookup_bug:global entity−kind "entity" used instead of entity−kind "entity"(cfront compatibility)0496 redeclaration_of_template_param_name:template parameter "xxxx" may not be redeclared in this scope0497 decl_hides_template_parameter:declaration of "xxxx" hides template parameter0498 must_be_prototype_instantiation:template argument list must match the parameter list0500 bad_extra_arg_for_postfix_operator:extra parameter of postfix "operatorxxxx" must be of type "int"ERRORS0501 function_type_required:an operator name must be declared as a function0502 operator_name_not_allowed:operator name is not allowed0503 bad_scope_for_specialization:entity−kind "entity" cannot be specialized in the current scope


Error MessagesA−370504 nonstd_member_function_address:nonstandard form for taking the address of a member function0505 too_few_template_params:too few template parameters −− does not match previousdeclaration0506 too_many_template_params:too many template parameters −− does not match previousdeclaration0507 template_operator_delete:function template for operator delete(void *) is not allowed0508 class_template_same_name_as_templ_param:class template and template parameter may not have the same name0510 unnamed_type_in_template_arg:a template argument may not reference an unnamed type0511 enum_type_not_allowed:enumerated type is not allowed0512 qualified_reference_type:type qualifier on a reference type is not allowed0513 incompatible_assignment_operands:a value of type "type" cannot be assigned to an entity of type "type"0514 unsigned_compare_with_negative:pointless comparison of unsigned integer with a negative constant0515 converting_to_incomplete_class:cannot convert to incomplete class "type"0516 missing_initializer_on_unnamed_const:const object requires an initializer0517 unnamed_object_with_uninitialized_field:object has an uninitialized const or reference member••••••••


A−38Appendix A0518 nonstd_pp_directive:nonstandard preprocessing directive0519 unexpected_template_arg_list:entity−kind "entity" may not have a template argument list0520 missing_initializer_list:initialization with "{...}" expected for aggregate object0521 incompatible_ptr_to_member_selection_operands:pointer−to−member selection class types are incompatible ("type"and "type")0522 self_friendship:pointless friend declaration0523 period_used_as_qualifier:"." used in place of "::" to form a qualified name (cfrontanachronism)0524 const_function_anachronism:non−const function called for const object (anachronism)0525 dependent_stmt_is_declaration:a dependent statement may not be a declaration0526 void_param_not_allowed:a parameter may not have void type0529 bad_templ_arg_expr_operator:this operator is not allowed in a template argument expressionERRORS0530 missing_handler:try block requires at least one handler0531 missing_exception_declaration:handler requires an exception declaration0532 masked_by_default_handler:handler is masked by default handler


Error MessagesA−390533 masked_by_handler:handler is potentially masked by previous handler for type "type"0534 local_type_used_in_exception:use of a local type to specify an exception0535 redundant_exception_specification_type:redundant type in exception specification0536 incompatible_exception_specification:exception specification is incompatible with that of previousentity−kind "entity" (declared at line xxxx):0540 no_exception_support:support for exception handling is disabled0541 omitted_exception_specification:omission of exception specification is incompatible with previousentity−kind "entity" (declared at line xxxx)0542 cannot_create_instantiation_request_file:could not create instantiation request file "xxxx"0543 non_arith_operation_in_templ_arg:non−arithmetic operation not allowed in nontype templateargument0544 local_type_in_nonlocal_var:use of a local type to declare a nonlocal variable0545 local_type_in_function:use of a local type to declare a function0546 branch_past_initialization:transfer of control bypasses initialization of:0548 branch_into_handler:transfer of control into an exception handler0549 used_before_set:entity−kind "entity" is used before its value is set••••••••


A−40Appendix A0550 set_but_not_used:entity−kind "entity" was set but never used0551 bad_scope_for_definition:entity−kind "entity" cannot be defined in the current scope0552 exception_specification_not_allowed:exception specification is not allowed0553 template_and_instance_linkage_conflict:external/internal linkage conflict for entity−kind "entity" (declared atline xxxx)0554 conversion_function_not_usable:entity−kind "entity" will not be called for implicit or explicitconversions0555 tag_kind_incompatible_with_template_parameter:tag kind of xxxx is incompatible with template parameter of type"type"0556 template_operator_new:function template for operator new(size_t) is not allowed0558 bad_member_type_in_ptr_to_member:pointer to member of type "type" is not allowed0559 ellipsis_on_operator_function:ellipsis is not allowed in operator function parameter list0560 unimplemented_keyword:"entity" is reserved for future use as a keywordERRORS0561 cl_invalid_macro_definition:invalid macro definition:0562 cl_invalid_macro_undefinition:invalid macro undefinition:0563 cl_invalid_preprocessor_output_file:invalid preprocessor output file


Error MessagesA−410564 cl_cannot_open_preprocessor_output_file:cannot open preprocessor output file0565 cl_il_file_must_be_specified:IL file name must be specified if input is0566 cl_invalid_il_output_file:invalid IL output file0567 cl_cannot_open_il_output_file:cannot open IL output file0568 cl_invalid_C_output_file:invalid C output file0569 cl_cannot_open_C_output_file:cannot open C output file0570 cl_error_in_debug_option_argument:error in debug option argument0571 cl_invalid_option:invalid option:0572 cl_back_end_requires_il_file:back end requires name of IL file0573 cl_could_not_open_il_file:could not open IL file0574 cl_invalid_number:invalid number:0575 cl_incorrect_host_id:incorrect host CPU id0576 cl_invalid_instantiation_mode:invalid instantiation mode:0578 cl_invalid_error_limit:invalid error limit:••••••••


A−42Appendix A0579 cl_invalid_raw_listing_output_file:invalid raw−listing output file0580 cl_cannot_open_raw_listing_output_file:cannot open raw−listing output file0581 cl_invalid_xref_output_file:invalid cross−reference output file0582 cl_cannot_open_xref_output_file:cannot open cross−reference output file0583 cl_invalid_error_output_file:invalid error output file0584 cl_cannot_open_error_output_file:cannot open error output file0585 cl_vtbl_option_only_in_cplusplus:virtual function tables can only be suppressed when compiling <strong>C++</strong>0586 cl_anachronism_option_only_in_cplusplus:anachronism option can be used only when compiling <strong>C++</strong>0587 cl_instantiation_option_only_in_cplusplus:instantiation mode option can be used only when compiling <strong>C++</strong>0588 cl_auto_instantiation_option_only_in_cplusplus:automatic instantiation mode can be used only when compiling <strong>C++</strong>ERRORS0589 cl_implicit_inclusion_option_only_in_cplusplus:implicit template inclusion mode can be used only when compiling<strong>C++</strong>0590 cl_exceptions_option_only_in_cplusplus:exception handling option can be used only when compiling <strong>C++</strong>0591 cl_strict_ansi_incompatible_with_pcc:strict ANSI mode is incompatible with K&R mode


Error MessagesA−430592 cl_strict_ansi_incompatible_with_cfront:strict ANSI mode is incompatible with cfront mode0593 cl_missing_source_file_name:missing source file name0594 cl_output_file_incompatible_with_multiple_inputs:output files may not be specified when compiling several input files0595 cl_too_many_arguments:too many arguments on command line0596 cl_no_output_file_needed:an output file was specified, but none is needed0597 cl_il_display_requires_il_file_name:IL display requires name of IL file0598 void_template_parameter:a template parameter may not have void type0599 too_many_unused_instantiations:excessive recursive instantiation of entity−kind "entity" due toinstantiate−all mode0600 cl_strict_ansi_incompatible_with_anachronisms:strict ANSI mode is incompatible with allowing anachronisms0601 void_throw:a throw expression may not have void type0602 cl_tim_local_conflicts_with_auto_instantiation:local instantiation mode is incompatible with automatic instantiation0603 abstract_class_param_type:parameter of abstract class type "type" is not allowed:0604 array_of_abstract_class:array of abstract class "type" is not allowed:••••••••


A−44Appendix A0605 float_template_parameter:floating−point template parameter is nonstandard0606 pragma_must_precede_declaration:this pragma must immediately precede a declaration0607 pragma_must_precede_statement:this pragma must immediately precede a statement0608 pragma_must_precede_decl_or_stmt:this pragma must immediately precede a declaration or statement0609 pragma_may_not_be_used_here:this kind of pragma may not be used here0611 partial_override:overloaded virtual function "entity" is only partially overridden inentity−kind "entity"0612 specialization_of_called_inline_template_function:specific definition of inline template function must precede its firstuse0613 cl_invalid_error_tag:invalid error tag:0614 cl_invalid_error_number:invalid error number:0615 param_type_ptr_to_array_of_unknown_bound:parameter type involves pointer to array of unknown boundERRORS0616 param_type_ref_array_of_unknown_bound:parameter type involves reference to array of unknown bound0617 ptr_to_member_cast_to_ptr_to_function:pointer−to−member−function cast to pointer to function0618 no_named_fields:struct or union declares no named members


Error MessagesA−450619 nonstd_unnamed_field:nonstandard unnamed field0620 nonstd_unnamed_member:nonstandard unnamed member0622 cl_invalid_pch_output_file:invalid precompiled header output file0623 cl_cannot_open_pch_output_file:cannot open precompiled header output file0624 not_a_type_name:"xxxx" is not a type name0625 cl_cannot_open_pch_input_file:cannot open precompiled header input file0626 invalid_pch_file:precompiled header file "xxxx" is either invalid or not generated bythis version of the compiler0627 pch_curr_directory_changed:precompiled header file "xxxx" was not generated in this directory0628 pch_header_files_have_changed:header files used to generate precompiled header file "xxxx" havechanged0629 pch_cmd_line_option_mismatch:the command line options do not match those used whenprecompiled header file "xxxx" was created0630 pch_file_prefix_mismatch:the initial sequence of preprocessing directives is not compatiblewith those of precompiled header file "xxxx"0631 unable_to_get_mapped_memory:unable to obtain mapped memory••••••••


A−46Appendix A0632 using_pch:"xxxx": using precompiled header file "xxxx"0633 creating_pch:"xxxx": creating precompiled header file "xxxx"0634 memory_mismatch:memory usage conflict with precompiled header file "xxxx"0635 cl_invalid_pch_size:invalid PCH memory size0636 cl_pch_must_be_first:PCH options must appear first in the command line0637 out_of_memory_during_pch_allocation:insufficient memory for PCH memory allocation0638 cl_pch_incompatible_with_multiple_inputs:precompiled header files may not be used when compiling severalinput files0639 not_enough_preallocated_memory:insufficient preallocated memory for generation of precompiledheader file (xxxx bytes required)0640 program_entity_too_large_for_pch:very large entity in program prevents generation of precompiledheader file0641 cannot_chdir:"xxxx" is not a valid directoryERRORS0642 cannot_build_temp_file_name:cannot build temporary file name0643 restrict_not_allowed:"restrict" is not allowed


Error MessagesA−470644 restrict_pointer_to_function:a pointer or reference to function type may not be qualified by"restrict"0645 bad_declspec_modifier:"xxxx" is an unrecognized __declspec attribute0646 calling_convention_not_allowed:a calling convention modifier may not be specified here0647 conflicting_calling_conventions:conflicting calling convention modifiers0648 cl_strict_ansi_incompatible_with_microsoft:strict ANSI mode is incompatible with Microsoft mode0649 cl_cfront_incompatible_with_microsoft:cfront mode is incompatible with Microsoft mode0650 calling_convention_ignored:calling convention specified here is ignored0651 calling_convention_may_not_precede_nested_declarator:a calling convention may not be followed by a nested declarator0652 calling_convention_ignored_for_type:calling convention is ignored for this type0654 decl_modifiers_incompatible_with_previous_decl:declaration modifiers are incompatible with previous declaration0655 decl_modifiers_invalid_for_this_decl:the modifier "xxxx" is not allowed on this declaration0656 branch_into_try_block:transfer of control into a try block0657 incompatible_inline_specifier_on_specific_decl:inline specification is incompatible with previous "entity" (declaredat line xxxx)••••••••


A−48Appendix A0658 template_missing_closing_brace:closing brace of template definition not found0659 cl_wchar_t_option_only_in_cplusplus:wchar_t keyword option can be used only when compiling <strong>C++</strong>0660 bad_pack_alignment:invalid packing alignment value0661 exp_int_constant:expected an integer constant0662 call_of_pure_virtual:call of pure virtual function0663 bad_ident_string:invalid source file identifier string0664 template_friend_definition_not_allowed:a class template cannot be defined in a friend declaration0665 asm_not_allowed:"asm" is not allowed0666 bad_asm_function_def:"asm" must be used with a function definition0667 nonstd_asm_function:"asm" function is nonstandard0668 nonstd_ellipsis_only_param:ellipsis with no explicit parameters is nonstandardERRORS0669 nonstd_address_of_ellipsis:"&..." is nonstandard0670 bad_address_of_ellipsis:invalid use of "&..."


Error MessagesA−490672 const_volatile_ref_init_anachronism:temporary used for initial value of reference to const volatile(anachronism)0673 bad_const_volatile_ref_init:a reference of type "type" cannot be initialized with a value of type"type"0674 const_volatile_ref_init_from_rvalue:initial value of reference to const volatile must be an lvalue0675 cl_SVR4_C_option_only_in_ansi_C:SVR4 C compatibility option can be used only when compiling ANSIC0676 using_out_of_scope_declaration:using out−of−scope declaration of entity−kind "entity" (declared atline xxxx)0677 cl_strict_ansi_incompatible_with_SVR4:strict ANSI mode is incompatible with SVR4 C mode0678 cannot_inline_call:call of entity−kind "entity" (declared at line xxxx) cannot be inlined0679 cannot_inline:entity−kind "entity" cannot be inlined0680 cl_invalid_pch_directory:invalid PCH directory:0681 exp_except_or_finally:expected __except or __finally0682 leave_must_be_in_try:a __leave statement may only be used within a __try0688 not_found_on_pack_alignment_stack:"xxxx" not found on pack alignment stack••••••••


A−50Appendix A0689 empty_pack_alignment_stack:empty pack alignment stack0690 cl_rtti_option_only_in_cplusplus:RTTI option can be used only when compiling <strong>C++</strong>0691 inaccessible_elided_cctor:entity−kind "entity", required for copy that was eliminated, isinaccessible0692 uncallable_elided_cctor:entity−kind "entity", required for copy that was eliminated, is notcallable because reference parameter cannot be bound to rvalue0693 typeid_needs_typeinfo: must be included before typeid is used0694 cannot_cast_away_const:xxxx cannot cast away const or other type qualifiers0695 bad_dynamic_cast_type:the type in a dynamic_cast must be a pointer or reference to acomplete class type, or void *0696 bad_ptr_dynamic_cast_operand:the operand of a pointer dynamic_cast must be a pointer to acomplete class type0697 bad_ref_dynamic_cast_operand:the operand of a reference dynamic_cast must be an lvalue of acomplete class typeERRORS0698 dynamic_cast_operand_must_be_polymorphic:the operand of a runtime dynamic_cast must have a polymorphicclass type0699 cl_bool_option_only_in_cplusplus:bool option can be used only when compiling <strong>C++</strong>0701 array_type_not_allowed:an array type is not allowed here


Error MessagesA−510702 exp_assign:expected an "="0703 exp_declarator_in_condition_decl:expected a declarator in condition declaration0704 redeclaration_of_condition_decl_name:"xxxx", declared in condition, may not be redeclared in this scope0705 default_template_arg_not_allowed:default template arguments are not allowed for function templates0706 exp_comma_or_gt:expected a "," or ">"0707 missing_template_param_list:expected a template parameter list0708 incr_of_bool_deprecated:incrementing a bool value is deprecated0709 bool_type_not_allowed:bool type is not allowed0710 base_class_offset_too_large:offset of base class "entity" within class "entity" is too large0711 expr_not_bool:expression must have bool type (or be convertible to bool)0712 cl_array_new_and_delete_option_only_in_cplusplus:array new and delete option can be used only when compiling <strong>C++</strong>0713 based_requires_variable_name:entity−kind "entity" is not a variable name0714 based_not_allowed_here:__based modifier is not allowed here0715 based_not_followed_by_star:__based does not precede a pointer operator, __based ignored••••••••


A−52Appendix A0716 based_var_must_be_ptr:variable in __based modifier must have pointer type0717 bad_const_cast_type:the type in a const_cast must be a pointer, reference, or pointer tomember to an object type0718 bad_const_cast:a const_cast can only adjust type qualifiers; it cannot change theunderlying type0719 mutable_not_allowed:mutable is not allowed0720 cannot_change_access:redeclaration of entity−kind "entity" is not allowed to alter its access0721 nonstd_printf_format_string:nonstandard format string conversion0722 probable_inadvertent_lbracket_digraph:use of alternative token "


Error MessagesA−530729 bad_combination_of_dll_attributes:invalid combination of DLL attributes0730 sym_not_a_class_template:entity−kind "entity" is not a class template0731 array_of_incomplete_type:array with incomplete element type is nonstandard0732 allocation_operator_in_namespace:allocation operator may not be declared in a namespace0733 deallocation_operator_in_namespace:deallocation operator may not be declared in a namespace0734 conflicts_with_using_decl:entity−kind "entity" conflicts with using−declaration of entity−kind"entity"0735 using_decl_conflicts_with_prev_decl:using−declaration of entity−kind "entity" conflicts with entity−kind"entity" (declared at line xxxx)0736 cl_namespaces_option_only_in_cplusplus:namespaces option can be used only when compiling <strong>C++</strong>0737 useless_using_declaration:using−declaration ignored −− it refers to the current namespace0738 class_qualified_name_required:a class−qualified name is required0741 using_declaration_ignored:using−declaration of entity−kind "entity" ignored0742 not_an_actual_member:entity−kind "entity" has no actual member "xxxx"0744 mem_attrib_incompatible:incompatible memory attributes specified••••••••


A−54Appendix A0745 mem_attrib_ignored:memory attribute ignored0746 mem_attrib_may_not_precede_nested_declarator:memory attribute may not be followed by a nested declarator0747 dupl_mem_attrib:memory attribute specified more than once0748 dupl_calling_convention:calling convention specified more than once0749 type_qualifier_not_allowed:a type qualifier is not allowed0750 template_instance_already_used:entity−kind "entity" (declared at line xxxx) was used before itstemplate was declared0751 static_nonstatic_with_same_param_types:static and nonstatic member functions with same parameter typescannot be overloaded0752 no_prior_declaration:no prior declaration of entity−kind "entity"0753 template_id_not_allowed:a template−id is not allowed0754 class_qualified_name_not_allowed:a class−qualified name is not allowedERRORS0755 bad_scope_for_redeclaration:entity−kind "entity" may not be redeclared in the current scope0756 qualifier_in_namespace_member_decl:qualified name is not allowed in namespace member declaration0757 sym_not_a_type_name:entity−kind "entity" is not a type name


Error MessagesA−550758 explicit_instantiation_not_in_namespace_scope:explicit instantiation is not allowed in the current scope0759 bad_scope_for_explicit_instantiation:entity−kind "entity" cannot be explicitly instantiated in the currentscope0760 multiple_explicit_instantiations:entity−kind "entity" explicitly instantiated more than once0761 typename_not_in_template:typename may only be used within a template0762 cl_special_subscript_cost_option_only_in_cplusplus:special_subscript_cost option can be used only when compiling<strong>C++</strong>0763 cl_typename_option_only_in_cplusplus:typename option can be used only when compiling <strong>C++</strong>0764 cl_implicit_typename_option_only_in_cplusplus:implicit typename option can be used only when compiling <strong>C++</strong>0765 nonstd_character_at_start_of_macro_def:nonstandard character at start of object−like macro definition0766 exception_spec_override_incompat:exception specification for virtual entity−kind "entity" isincompatible with that of overridden entity−kind "entity"0767 pointer_conversion_loses_bits:conversion from pointer to smaller integer0768 generated_exception_spec_override_incompat:exception specification for implicitly declared virtual entity−kind"entity" is incompatible with that of overridden entity−kind "entity"0769 implicit_call_of_ambiguous_name:"entity", implicitly called from entity−kind "entity", is ambiguous••••••••


A−56Appendix A0770 cl_explicit_option_only_in_cplusplus:option "explicit" can be used only when compiling <strong>C++</strong>0771 explicit_not_allowed:"explicit" is not allowed0772 conflicts_with_predeclared_type_info:declaration conflicts with "xxxx" (reserved class name)0773 array_member_initialization:only "()" is allowed as initializer for array entity−kind "entity"0774 virtual_function_template:"virtual" is not allowed in a function template declaration0775 anon_union_class_member_template:invalid anonymous union −− class member template is not allowed0776 template_depth_mismatch:template nesting depth does not match the previous declaration ofentity−kind "entity"0777 multiple_template_decls_not_allowed:this declaration cannot have multiple "template " clauses0778 cl_old_for_init_option_only_in_cplusplus:option to control the for−init scope can be used only whencompiling <strong>C++</strong>0779 redeclaration_of_for_init_decl_name:"xxxx", declared in for−loop initialization, may not be redeclared inthis scopeERRORS0780 hidden_by_old_for_init:reference is to entity−kind "entity" (declared at line xxxx) −− underold for−init scoping rules it would have been entity−kind "entity"(declared at line xxxx)0781 cl_for_init_diff_warning_option_only_in_cplusplus:option to control warnings on for−init differences can be used onlywhen compiling <strong>C++</strong>


Error MessagesA−570782 unnamed_class_virtual_function_def_missing:definition of virtual entity−kind "entity" is required here0783 svr4_token_pasting_comment:empty comment interpreted as token−pasting operator "##"0784 storage_class_in_friend_decl:a storage class is not allowed in a friend declaration0785 templ_param_list_not_allowed:template parameter list for "entity" is not allowed in this declaration0786 bad_member_template_sym:entity−kind "entity" is not a valid member class or function template0787 bad_member_template_decl:not a valid member class or function template declaration0788 specialization_follows_param_list:a template declaration containing a template parameter list may notbe followed by an explicit specialization declaration0789 specialization_of_referenced_template:explicit specialization of entity−kind "entity" must precede the firstuse of entity−kind "entity"0790 explicit_specialization_not_in_namespace_scope:explicit specialization is not allowed in the current scope0791 partial_specialization_not_allowed:partial specialization of entity−kind "entity" is not allowed0792 entity_cannot_be_specialized:entity−kind "entity" is not an entity that can be explicitly specialized0793 specialization_of_referenced_entity:explicit specialization of entity−kind "entity" must precede its firstuse••••••••


A−58Appendix A0794 template_param_in_elab_type:template parameter xxxx may not be used in an elaborated typespecifier0795 old_specialization_not_allowed:specializing entity−kind "entity" requires "template" syntax0798 cl_old_specializations_option_only_in_cplusplus:option "old_specializations" can be used only when compiling <strong>C++</strong>0799 nonstd_old_specialization:specializing entity−kind "entity" without "template" syntax isnonstandard0800 bad_linkage_for_decl:this declaration may not have extern "C" linkage0801 not_a_template_name:"xxxx" is not a class or function template name in the current scope0802 nonstd_default_arg_on_function_template_redecl:specifying a default argument when redeclaring an unreferencedfunction template is nonstandard0803 default_arg_on_function_template_not_allowed:specifying a default argument when redeclaring an alreadyreferenced function template is not allowed0804 pm_derived_class_from_virtual_base:cannot convert pointer to member of base class "type" to pointer tomember of derived class "type" −− base class is virtualERRORS0805 bad_exception_specification_for_specialization:exception specification is incompatible with that of entity−kind"entity" (declared at line xxxx):0806 omitted_exception_specification_on_specialization:omission of exception specification is incompatible with entity−kind"entity" (declared at line xxxx)


Error MessagesA−590807 unexpected_end_of_default_arg:unexpected end of default argument expression0808 default_init_of_reference:default−initialization of reference is not allowed0809 uninitialized_field_with_const_member:uninitialized entity−kind "entity" has a const member0810 uninitialized_base_class_with_const_member:uninitialized base class "type" has a const member0811 missing_default_constructor_on_const:const entity−kind "entity" requires an initializer −− class "type" hasno explicitly declared default constructor0812 missing_default_constructor_on_unnamed_const:const object requires an initializer −− class "type" has no explicitlydeclared default constructor0813 cl_impl_extern_c_conv_option_only_in_cplusplus:option "implicit_extern_c_type_conversion" can be used only whencompiling <strong>C++</strong>0814 cl_strict_ansi_incompatible_with_long_preserving:strict ANSI mode is incompatible with long preserving rules0815 useless_type_qualifier_on_return_type:type qualifier on return type is meaningless0816 type_qualifier_on_void_return_type:in a function definition a type qualifier on a "void" return type isnot allowed0817 static_data_member_not_allowed:static data member declaration is not allowed in this class0818 invalid_declaration:template instantiation resulted in an invalid function declaration••••••••


A−60Appendix A0819 ellipsis_not_allowed:"..." is not allowed0820 cl_extern_inline_option_only_in_cplusplus:option "extern_inline" can be used only when compiling <strong>C++</strong>0821 extern_inline_never_defined:extern inline entity−kind "entity" was referenced but not defined0822 invalid_destructor_name:invalid destructor name for type "type"0824 ambiguous_destructor:destructor reference is ambiguous −− both entity−kind "entity" andentity−kind "entity" could be used0825 virtual_inline_never_defined:virtual inline entity−kind "entity" was never defined0826 unreferenced_function_param:entity−kind "entity" was never referenced0827 union_already_initialized:only one member of a union may be specified in a constructorinitializer list0828 no_array_new_and_delete_support:support for "new[]" and "delete[]" is disabled0829 double_for_long_double:"double" used for "long double" in generated C codeERRORS0830 no_corresponding_delete:entity−kind "entity" has no corresponding operator deletexxxx (tobe called if an exception is thrown during initialization of anallocated object)0831 useless_placement_delete:support for placement delete is disabled


Error MessagesA−610832 no_appropriate_delete:no appropriate operator delete is visible0833 ptr_or_ref_to_incomplete_type:pointer or reference to incomplete type is not allowed0834 bad_partial_specialization:invalid partial specialization −− entity−kind "entity" is already fullyspecialized0835 incompatible_exception_specs:incompatible exception specifications0836 returning_ref_to_local_variable:returning reference to local variable0837 nonstd_implicit_int:omission of explicit type is nonstandard ("int" assumed)0838 ambiguous_partial_spec:more than one partial specialization matches the template argumentlist of entity−kind "entity"0840 partial_spec_is_primary_template:a template argument list is not allowed in a declaration of a primarytemplate0841 default_not_allowed_on_partial_spec:partial specializations may not have default template arguments0842 not_used_in_partial_spec_arg_list:entity−kind "entity" is not used in template argument list ofentity−kind "entity"0843 partial_spec_param_depends_on_templ_param:the type of partial specialization template parameter entity−kind"entity" depends on another template parameter0844 partial_spec_arg_depends_on_templ_param:the template argument list of the partial specialization includes anontype argument whose type depends on a template parameter••••••••


A−62Appendix A0845 partial_spec_after_instantiation:this partial specialization would have been used to instantiateentity−kind "entity"0846 partial_spec_after_instantiation_ambiguous:this partial specialization would have been made the instantiation ofentity−kind "entity" ambiguous0847 expr_not_integral_or_enum:expression must have integral or enum type0848 expr_not_arithmetic_or_enum:expression must have arithmetic or enum type0849 expr_not_arithmetic_or_enum_or_pointer:expression must have arithmetic, enum, or pointer type0850 cast_not_integral_or_enum:type of cast must be integral or enum0851 cast_not_arithmetic_or_enum_or_pointer:type of cast must be arithmetic, enum, or pointer0852 expr_not_object_pointer:expression must be a pointer to a complete object type0853 member_partial_spec_not_in_class:a partial specialization of a member class template must be declaredin the class of which it is a memberERRORS0854 partial_spec_nontype_expr:a partial specialization nontype argument must be the name of anontype parameter or a constant0855 different_return_type_on_virtual_function_override:return type is not identical to return type "type" of overriddenvirtual function entity−kind "entity"0856 cl_guiding_decls_option_only_in_cplusplus:option "guiding_decls" can be used only when compiling <strong>C++</strong>


Error MessagesA−630857 member_partial_spec_not_in_namespace:a partial specialization of a class template must be declared in thenamespace of which it is a member0858 pure_virtual_function:entity−kind "entity" is a pure virtual function0859 no_overrider_for_pure_virtual_function:pure virtual entity−kind "entity" has no overrider0860 decl_modifiers_ignored:__declspec attributes ignored0861 invalid_char:invalid character in input line0862 incomplete_return_type:function returns incomplete type "type"0863 local_pragma_pack:effect of this "#pragma pack" directive is local to entity−kind "entity"0864 not_a_template:xxxx is not a template0865 friend_partial_specialization:a friend declaration may not declare a partial specialization0866 exception_specification_ignored:exception specification ignored0867 unexpected_type_for_size_t:declaration of "size_t" does not match the expected type "type"0868 exp_gt_not_shift_right:space required between adjacent ">" delimiters of nested templateargument lists (">>" is the right shift operator)0869 bad_multibyte_char_locale:could not set locale "xxxx" to allow processing of multibytecharacters••••••••


A−64Appendix A0870 bad_multibyte_char:invalid multibyte character sequence0871 bad_type_from_instantiation:template instantiation resulted in unexpected function type of "type"(the meaning of a name may have changed since the templatedeclaration −− the type of the template is "type")0872 ambiguous_guiding_decl:ambiguous guiding declaration −− more than one function template"entity" matches type "type"0873 non_integral_operation_in_templ_arg:non−integral operation not allowed in nontype template argument0874 cl_embedded_cplusplus_option_only_in_cplusplus:option "embedded_c++" can be used only when compiling <strong>C++</strong>0875 templates_in_embedded_cplusplus:Embedded <strong>C++</strong> does not support templates0876 exceptions_in_embedded_cplusplus:Embedded <strong>C++</strong> does not support exception handling0877 namespaces_in_embedded_cplusplus:Embedded <strong>C++</strong> does not support namespaces0878 rtti_in_embedded_cplusplus:Embedded <strong>C++</strong> does not support run time type information0879 new_cast_in_embedded_cplusplus:Embedded <strong>C++</strong> does not support the new cast syntaxERRORS0880 using_decl_in_embedded_cplusplus:Embedded <strong>C++</strong> does not support using declarations0881 mutable_in_embedded_cplusplus:Embedded <strong>C++</strong> does not support "mutable"0882 multiple_inheritance_in_embedded_cplusplus:Embedded <strong>C++</strong> does not support multiple or virtual inheritance


Error MessagesA−650883 cl_invalid_microsoft_version:invalid Microsoft version number0884 inheritance_kind_already_set:pointer−to−member representation has already been set forentity−kind "entity"0885 bad_constructor_type:"type" cannot be used to designate constructor for "type"0886 bad_suffix:invalid suffix on integral constant0887 uuidof_requires_uuid_class_type:operand of __uuiof must have a class type for which__declspec(uuid("...")) has been specified0888 bad_uuid_string:invalid GUID string in __declspec(uuid("..."))0889 cl_vla_option_only_in_C:option "vla" can be used only when compiling C0890 vla_with_unspecified_bound_not_allowed:variable length array with unspecified bound is not allowed0891 explicit_template_args_not_allowed:an explicit template argument list is not allowed on this declaration0892 variably_modified_type_not_allowed:an entity with linkage cannot have a variably modified type0893 vla_is_not_autoa variable length array cannot have static storage duration0894 sym_not_a_template:entity−kind "entity" is not a template0896 expected_template_arg:expected a template argument••••••••


A−66Appendix A0897 explicit_template_args_in_expr:explicit function template argument lists are not supported yet inexpression contexts0898 no_params_with_class_or_enum_type:nonmember operator requires a parameter with class or enum type0899 cl_enum_oveloading_option_only_in_cplusplus:option "enum_overloading" can be used only when compiling <strong>C++</strong>0901 destructor_qualifier_type_mismatch:qualifier of destructor name "type" does not match type "type"0902 type_qualifier_ignored:type qualifier ignored0903 cl_nonstandard_qualifier_deduction_option_only_in_cplusplus:option "nonstd_qualifier_deduction" can be used only whencompiling <strong>C++</strong>0905 bad_declspec_property:incorrect property specification; correct form is__declspec(property(get=name1,put=name2))0906 dupl_get_or_put:property has already been specified0907 declspec_property_not_allowed:__declspec(property) is not allowed on this declarationERRORS0908 no_get_property:member is declared with __declspec(property), but no "get"function was specified0909 get_property_function_missing:the __declspec(property) "get" function "xxxx" is missing0910 no_put_property:member is declared with __declspec(property), but no "put"function was specified


Error MessagesA−670911 put_property_function_missing:the __declspec(property) "put" function "xxxx" is missing0912 dual_lookup_ambiguous_name:ambiguous class member reference −− entity−kind "entity" (declaredat line xxxx) used in preference to entity−kind "entity" (declared atline xxxx)0913 bad_allocate_segname:missing or invalid segment name in __declspec(allocate("..."))0914 declspec_allocate_not_allowed:__declspec(allocate) is not allowed on this declaration0915 dupl_allocate_segname:a segment name has already been specified0916 pm_virtual_base_from_derived_class:cannot convert pointer to member of derived class "type" to pointerto member of base class "type" −− base class is virtual0917 cl_invalid_instantiation_directory:invalid directory for instantiation files:0918 cl_one_instantiation_per_object_option_only_in_cplusplus:option "one_instantiation_per_object" can be used only whencompiling <strong>C++</strong>0919 invalid_output_file:invalid output file: "xxxx"0920 cannot_open_output_file:cannot open output file: "xxxx"0921 cl_ii_file_name_incompatible_with_multiple_inputs:an instantiation information file name may not be specified whencompiling several input files0922 cl_one_instantiation_per_object_incompatible_with_multiple_inputs:option "one_instantiation_per_object" may not be used whencompiling several input files••••••••


A−68Appendix A0923 cl_ambiguous_option:more than one command line option matches the abbreviation"−−xxxx":0925 cv_qualified_function_type:a type qualifier cannot be applied to a function type0926 cannot_open_definition_list_file:cannot open definition list file: "xxxx"0927 cl_late_tiebreaker_option_only_in_cplusplus:late/early tiebreaker option can be used only when compiling <strong>C++</strong>0928 cl_strict_ansi_incompatible_with_tsw_extensions:strict ANSI mode is incompatible with TASKING Embedded <strong>C++</strong>extensions0929 tsw_embedded_extensions_not_allowed:TASKING Embedded <strong>C++</strong> extensions not allowed0930 tsw_at_already_used:_at() can only be used once in a declaration0931 tsw_atbit_already_used:_atbit() can only be used once in a declaration0932 tsw_at_atbit_conflict:_at() and _atbit() cannot be used in the same declaration0941 tsw_expr_not_integral_or_fractional:expression must have integral or fractional typeERRORS0942 tsw_expr_not_integral_or_enum_or_fractional:expression must have integral, enum or fractional type0943 cl_options_after_input_file_not_allowed:options are not allowed after the input file name0944 bad_va_start:incorrect use of va_start


Error MessagesA−690945 bad_va_arg:incorrect use of va_arg0946 bad_va_end:incorrect use of va_end0947 cl_pending_instantiations_option_only_in_cplusplus:pending instantiations option can be used only when compiling<strong>C++</strong>0948 cl_invalid_import_directory:invalid directory for #import files:0949 cl_import_only_in_microsoft:an import directory can be specified only in Microsoft mode0950 ref_not_allowed_in_union:a member with reference type is not allowed in a union0951 typedef_not_allowed:"typedef" may not be specified here0952 redecl_changes_access:redeclaration of entity−kind "entity" alters its access0953 qualified_name_required:a class or namespace qualified name is required0954 implicit_int_on_main:return type "int" omitted in declaration of function "main"0955 invalid_inheritance_kind_for_class:pointer−to−member representation "xxxx" is too restrictive forentity−kind "entity"0956 implicit_return_from_non_void_function:missing return statement at end of non−void entity−kind "entity"0957 duplicate_using_decl:duplicate using−declaration of "entity" ignored••••••••


A−70Appendix A0958 unsigned_enum_bit_field_with_signed_enumerator:enum bit−fields are always unsigned, but enum "type" includesnegative enumerator0959 cl_class_name_injection_option_only_in_cplusplus:option "class_name_injection" can be used only when compiling<strong>C++</strong>0960 cl_arg_dependent_lookup_option_only_in_cplusplus:option "arg_dep_lookup" can be used only when compiling <strong>C++</strong>0961 cl_friend_injection_option_only_in_cplusplus:option "friend_injection" can be used only when compiling <strong>C++</strong>0962 invalid_name_after_template:name following "template" must be a member template0964 local_class_friend_requires_prior_decl:nonstandard local−class friend declaration −− no prior declaration inthe enclosing scope0965 nonstd_default_arg:specifying a default argument on this declaration is nonstandard0966 cl_nonstd_using_decl_option_only_in_cplusplus:option "nonstd_using_decl" can be used only when compiling <strong>C++</strong>0967 bad_return_type_on_main:return type of function "main" must be "int"0968 template_parameter_has_class_type:a template parameter may not have class typeERRORS0969 default_arg_on_member_decl:a default template argument cannot be specified on the declarationof a member of a class template0970 return_from_ctor_function_try_block_handler:a return statement is not allowed in a handler of a function tryblock of a constructor


Error MessagesA−710971 no_ordinary_and_extended_designators:ordinary and extended designators cannot be combined in aninitializer designation0972 no_negative_designator_range:the second subscript must not be smaller than the first0973 cl_designators_option_only_in_C:option "designators" can be used only when compiling C0974 cl_extended_designators_option_only_in_C:option "extended_designators" can be used only when compiling C0975 extra_bits_ignored:declared size for bit field is larger than the size of the bit field type;truncated to xxxx bits0976 constructor_type_mismatch:type used as constructor name does not match type "type"0977 type_with_no_linkage_in_var_with_linkage:use of a type with no linkage to declare a variable with linkage0978 type_with_no_linkage_in_function:use of a type with no linkage to declare a function0979 return_type_on_constructor:return type may not be specified on a constructor0980 return_type_on_destructor:return type may not be specified on a destructor0981 malformed_universal_character:incorrectly formed universal character name0982 invalid_UCN:universal character name specifies an invalid character0983 UCN_names_basic_char:a universal character name cannot designate a character in the basiccharacter set••••••••


A−72Appendix A0984 invalid_identifier_UCN:this universal character is not allowed in an identifier0985 VA_ARGS_not_allowed:the identifier __VA_ARGS__ can only appear in the replacement listsof variadic macros0986 friend_qualification_ignored:the qualifier on this friend declaration is ignored0987 no_range_designator_with_dynamic_init:array range designators cannot be applied to dynamic initializers0988 property_name_not_allowed:property name cannot appear here0989 inline_qualifier_ignored:"inline" used as a function qualifier is ignored0990 cl_compound_literals_option_only_in_C:option "compound_literals" can be used only when compiling C0991 vla_not_allowed:a variable−length array type is not allowed0992 bad_integral_compound_literal:a compound literal is not allowed in an integral constant expression0993 bad_compound_literal_type:a compound literal of type "type" is not allowedERRORS0994 friend_template_in_local_class:a template friend declaration cannot be declared in a local class0995 ambiguous_question_operator:ambiguous "?" operation: second operand of type "type" can beconverted to third operand type "type", and vice versa0996 bad_call_of_class_object:call of an object of a class type without appropriate operator() orconversion functions to pointer−to−function type


Error MessagesA−730997 surrogate_func_add_on:surrogate function from conversion name0998 ambiguous_class_call:there is more than one way an object of type "type" can be calledfor the argument list:0999 expected_asm_before_endasm_pragma:expected a pragma asm before pragma endasm1000 end_of_source_reached_before_pragma_endasm:end of source reached while searching for pragma endasm1001 similar_typedef:typedef name has already been declared (with similar type)1002 no_internal_linkage_for_new_or_delete:operator new and operator delete cannot be given internal linkage1003 no_mutable_allowed_on_anonymous_union:storage class "mutable" is not allowed for anonymous unions1004 bad_pch_file:invalid precompiled header file1005 abstract_class_catch_type:abstract class type "type" is not allowed as catch type:1006 bad_qualified_function_type:a qualified function type cannot be used to declare a nonmemberfunction or a static member function1007 bad_qualified_function_type_parameter:a qualified function type cannot be used to declare a parameter1008 ptr_or_ref_to_qualified_function_type:cannot create a pointer or reference to qualified function type1009 nonstd_braces:extra braces are nonstandard••••••••


A−74Appendix A1010 bad_cmd_line_macro:invalid macro definition:1011 nonstandard_ptr_minus_ptr:subtraction of pointer types "type" and "type" is nonstandard1012 empty_template_param_list:an empty template parameter list is not allowed in a templatetemplate parameter declaration1013 exp_class:expected "class"1014 struct_not_allowed:the "class" keyword must be used when declaring a templatetemplate parameter1015 virtual_function_decl_hidden:entitykind "entity" is hidden by "entity" virtual function overrideintended?1016 no_qualified_friend_definition:a qualified name is not allowed for a friend declaration that is afunction definition1017 not_compatible_with_templ_templ_param:entitykind "entity" is not compatible with entitykind "entity"1018 storage_class_requires_function_or_variable:a storage class may not be specified hereERRORS1019 member_using_must_be_visible_in_direct_base:class member designated by a usingdeclaration must be visible in adirect base class1020 cl_sun_incompatible_with_microsoft:Sun mode is incompatible with Microsoft mode1021 cl_sun_incompatible_with_cfront:Sun mode is incompatible with cfront mode


Error MessagesA−751022 cl_strict_ansi_incompatible_with_sun:strict ANSI mode is incompatible with Sun mode1023 cl_sun_mode_only_in_cplusplus:Sun mode is only allowed when compiling <strong>C++</strong>1024 template_template_param_same_name_as_templ_param:a template template parameter cannot have the same name as oneof its template parameters1025 recursive_def_arg_instantiation:recursive instantiation of default argument1026 dependent_type_in_templ_templ_param:a parameter of a template template parameter cannot depend on thetype of another template parameter1027 bad_template_name:entitykind "entity" is not an entity that can be defined1028 destructor_name_must_be_qualified:destructor name must be qualified1029 no_typename_in_friend_class_decl:friend class name may not be introduced with "typename"1030 no_ctor_or_dtor_using_declaration:a usingdeclaration may not name a constructor or destructor1031 friend_is_nonreal_template:a qualified friend template declaration must refer to a specificpreviously declared template1032 bad_class_template_decl:invalid specifier in class template declaration1033 simple_incompatible_param:argument is incompatible with formal parameter••••••••


A−76Appendix A1034 asmfunc_not_allowed:use ’extern "asm"’ instead of ’_asmfunc’ for external assemblyfunctionsERRORS


APPENDIXUTILITY PROGRAMSB


UTILITIESB−2APPENDIXAppendix BB


Utility ProgramsB−31 INTRODUCTIONThis appendix describes the utility programs that are delivered with the<strong>C++</strong> compiler. The utility programs help with various link−time issues andare meant to be called from the control program.When you use a UNIX shell (Bourne shell, C−shell), arguments containingspecial characters (such as ’( )’ and ’?’) must be enclosed with "" orescaped. The −? option (in the C−shell) becomes: "−?" or −\?.2 PRELINKERThe prelinker is invoked at link time by the control program to manageautomatic instantiation of template entities. It is given a complete list of theobject files and libraries that are to be linked together. It examines theexternal names defined and referenced within those files, and finds caseswhere template entities are referenced but not defined. It then examinesinformation in the object files that describes instantiations that could havebeen done during compilation, and assigns the needed instantiations toappropriate files. The prelinker then invokes the compiler again tocompile those files, which will do the necessary instantiations.The invocation syntax of the <strong>C++</strong> prelinker is:prelk166 [option]... fileswhere the files list includes all object files and libraries, and the optionsare:−? Display an explanation of options at stdout.−V−c c−D−i−lxxx−LDisplay version information at stderr.Use c as symbol prefix character instead of the defaultunderscore.Do not assign instantiation to non−local object files.Instantiations may only be assigned to object files in thecurrent directory.Ignore invalid input lines.Specify a library (e.g., −lcp).Skip system library search.••••••••


B−4Appendix B−L directory Specify an additional search path for system libraries.−m−n−N−o file−O−q−r−R numberDo not demangle identifier names that are displayed.Update the instantiation list files (.ii), but do not recompilethe source files.If a file from a non−local directory needs to be recompiled,do the compilation in the current directory. An updated listof object files and library names is written to the file specifiedby the −o option so that the control program can tell thatalternate versions of some of the object files should be used.Write an updated list of object files and library names to thefile specified by file. Use this option when the −N or −Ooption is used.One instantiation per object mode is used. A list of objectfiles, including the instantiation object files associated withthe object files specified on the prelinker command line, iswritten to the file specified by the −o option.Quiet mode. Turns off verbose mode.Do not stop after the maximum number of iterations. (Theinstantiation process is iterative: a recompilation may bringup new template entities that need to be instantiated, whichrequires another recompilation, etc. Some recursive templatescan cause iteration that never terminates, because eachiteration introduces another new entity that was notpreviously there. By default, this process is stopped after acertain number of iterations.)Override the number of reserved instantiation information filelines to be used.UTILITIES−s number−S−T cpuSpecifies whether the prelinker should check for entities thatare referenced as both explicit specializations and generatedinstantiations. If number is zero the check is disabled,otherwise the check is enabled.Suppress instantiation flags in the object files.Set the target CPU type. This name is used to determine theactual location of the system libraries relative to the defaultlib directory.


Utility ProgramsB−5−u−vSpecify that external names do not have an added leadingunderscore. By default, external names get a leadingunderscore. With this option you specify that the leadingunderscore belongs to the external name.Verbose mode.3 MUNCHERThe muncher implements a lowest−common−denominator method forgetting global initialization and termination code executed on systems thathave no special support for that.The muncher accepts the output of the linker as its input file andgenerates a C program that defines a data structure containing a list ofpointers to the initialization and termination routines. This generatedprogram is then compiled and linked in with the executable. The datastructure is consulted at run−time by startup code invoked from _main,and the routines on the list are invoked at the appropriate times.The invocation syntax of the <strong>C++</strong> muncher is:munch166 [option]... [file]where the file is an output file generated by the linker, and the options are:−? Display an explanation of options at stdout.−V−c c−i n−o file−uDisplay version information at stderr.Use c as symbol prefix character instead of the defaultunderscoreSkip first n lines of input.Write output to file.Specify that external names do not have an added leadingunderscore. By default, external names get a leadingunderscore. With this option you specify that the leadingunderscore belongs to the external name.••••••••


UTILITIESB−6Appendix B


INDEXINDEX


INDEXIndex−2IndexINDEX


IndexIndex−3Symbols#define, 3−31#include, 3−58, 3−113system include directory, 3−98#pragma, 3−116#undef, 3−103__ARRAY_OPERATORS, 2−36, 3−103__cplusplus, 2−36, 3−103__DATE__, 2−36, 3−103__EXCEPTIONS, 2−36__FILE__, 2−36, 3−103__LINE__, 2−36, 3−103__NAMESPACES, 2−37__PLACEMENT_DELETE, 2−37__RTTI, 2−37__SIGNED_CHARS__, 2−36, 3−93,3−103__STDC__, 2−36, 3−103__STDC_VERSION__, 2−36__TIME__, 2−36, 3−103__TSW_IMPLICIT_USING_STD, 2−37__TSW_RUNTIME_USES_NAMESPACES, 2−37_BOOL, 2−36, 3−103_MODEL, 2−36_WCHAR_T, 2−36, 3−103Aalternative tokens, 3−18anachronism, 2−11anachronisms, 3−19, 3−26, 3−73ansi standard, 3−103array new and delete, 3−21automatic instantiation, 1−5automatic instantiation method, 2−29Bbool keyword, 3−24C<strong>C++</strong>language extensions, 2−5, 2−7library, 2−3<strong>C++</strong> dialect, 2−5, 2−7accepted, 2−8anachronisms accepted, 2−11cfront 2.1 and 3.0 extensions, 2−18cfront 2.1 extensions, 2−14new language features accepted, 2−8new language features not accepted,2−11normal <strong>C++</strong> mode extensions, 2−12not accepted, 2−11<strong>C++</strong> language featuresaccepted, 2−8not accepted, 2−11c_plusplus, 2−36, 3−103can_instantiate, 3−116catastrophic error, 4−3cfront, 3−262.1 and 3.0 extensions, 2−182.1 extensions, 2−14charactersigned, 3−93unsigned, 3−105class name injection, 3−27command file, 3−47compiler diagnostics, 4−1compiler limits, 3−118compiler use, 3−1const, string literals, 3−29••••••••


Index−4IndexINDEXcopy assignment operator, 3−23CP166INC, 3−113cross−reference, 3−112Ddetailed option description, compiler,3−163−112development flow, 1−4diagnostics, 4−1brief, 3−25error severity, 3−33, 4−3TASKING style, 3−101wrap, 3−111digraph, 3−18directory separator, 3−114do_not_instantiate, 3−116dollar signs, 3−36Eembedded <strong>C++</strong>, 3−38, 3−39entities, remove unneeded, 3−91enum overloading, 3−40environment variablesA166INC, 1−8<strong>C166</strong>INC, 1−8C<strong>C166</strong>INC, 1−8C<strong>C166</strong>OPT, 1−8CP166INC, 1−8, 3−113LINK166, 1−8LM_LICENSE_FILE, 1−8LOCATE166, 1−8M166INC, 1−8overview of, 1−8PATH, 1−8TASKING_LIC_WAIT, 1−8TMPDIR, 1−8used by tool chain, 1−8error, 4−3error level, 4−6error limit, 3−41error messages, A−1error number, 3−34error output file, 3−42error severity, 3−33, 4−3exception, 3−43exit status, 4−6explicit specifier, 3−44extension, 1−9.abs, 1−9.asm, 1−9.c, 1−9.cc, 1−9.cpp, 1−9.cxx, 1−9.hex, 1−9.ic, 1−9.lib, 1−9.lnl, 1−10.lno, 1−9.lst, 1−10.map, 1−10.mpe, 1−10.mpl, 1−10.obj, 1−9.out, 1−9.src, 1−9extensions to <strong>C++</strong>, 2−5, 2−7extern C, 3−54extern <strong>C++</strong>, 3−54extern inline, 3−46Ffile extensions, 1−9, 3−3for−init statement, 3−49, 3−70friend injection, 3−51function names, unqualified, 3−20


IndexIndex−5Gguiding declarations, 3−53Hhdrstop, 3−116header stop, 2−38, 2−43Iident, 3−117implicit inclusion, 2−35include files, 3−113at beginning of compilation, 3−59default directory, 3−114suffix, 3−57, 3−115inline function, 3−46inlining, 3−60instantiate, 3−116instantiation, 2−26automatic, 2−29directory, 3−63one file per object, 3−82pending, 3−88template, 3−61instantiation information file, 1−5instantiation mode, 2−31all, 2−32local, 2−32none, 2−31used, 2−31instantiation pragmas, 2−32internal error, 4−3introduction, 1−3invocation, 3−3Kkeywordbool, 3−24typename, 3−102wchar_t, 3−110Llabels__main, 2−46_main, 2−46language extensions, 3−95language implementation, 2−1library, 2−3license, wait for available license, 1−8license file, setting search directory,1−8lifetime, 3−66limits, compiler, 3−118list file, 3−64long, arithmetic conversion rules, 3−67lookup of unqualified function names,3−20Mmacrospredefined, 2−36variable argument list, 3−45, 3−108main labels, 2−46messagesdiagnostic, 4−3termination, 4−5muncher, 1−7, B−5••••••••


Index−6IndexINDEXNnamespace, 2−24, 3−69std, 3−107no_pch, 2−43, 3−116Oonce, 3−116operator, keywords, 3−18optimizations, c166, 2−46option file, 3−47options−?, 3−17−#, 3−99−$, 3−36−−alternative−tokens, 3−18−−anachronisms, 3−19−−arg−dep−lookup, 3−20−−array−new−and−delete, 3−21−−auto−instantiation, 3−22−−base−assign−op−is−default, 3−23−−bool, 3−24−−brief−diagnostics, 3−25−−cfront−2.1, 3−26−−cfront−3.0, 3−26−−class−name−injection, 3−27−−comments, 3−28−−const−string−literals, 3−29−−create−pch, 3−30−−define, 3−31−−dependencies, 3−32−−diag−error, 3−33−−diag−remark, 3−33−−diag−suppress, 3−33−−diag−warning, 3−33−−display−error−number, 3−34−−distinct−template−signatures, 3−35−−dollar, 3−36−−early−tiebreaker, 3−37−−embedded, 3−38−−embedded−c++, 3−39−−enum−overloading, 3−40−−error−limit, 3−41−−error−output, 3−42−−exceptions, 3−43−−explicit, 3−44−−extended−variadic−macros, 3−45−−extern−inline, 3−46−−for−init−diff−warning, 3−49−−force−vtbl, 3−50−−friend−injection, 3−51−−gen−c−file−name, 3−52−−guiding−decls, 3−53−−implicit−extern−c−type−conversion,3−54−−implicit−include, 3−55−−implicit−typename, 3−56−−incl−suffixes, 3−57−−include−directory, 3−58−−include−file, 3−59−−inlining, 3−60−−instantiate, 3−61−−instantiation−dir, 3−63−−late−tiebreaker, 3−37−−list−file, 3−64−−long−lifetime−temps, 3−66−−long−preserving−rules, 3−67−−namespaces, 3−69−−new−for−init, 3−70−−no−alternative−tokens, 3−18−−no−anachronisms, 3−19−−no−arg−dep−lookup, 3−20−−no−array−new−and−delete, 3−21−−no−auto−instantiation, 3−22−−no−base−assign−op−is−default,3−23−−no−bool, 3−24−−no−brief−diagnostics, 3−25−−no−class−name−injection, 3−27−−no−code−gen, 3−71−−no−const−string−literals, 3−29


IndexIndex−7−−no−distinct−template−signatures,3−35−−no−embedded, 3−38−−no−enum−overloading, 3−40−−no−exceptions, 3−43−−no−explicit, 3−44−−no−extended−variadic−macros,3−45−−no−extern−inline, 3−46−−no−for−init−diff−warning, 3−49−−no−friend−injection, 3−51−−no−guiding−decls, 3−53−−no−implicit−extern−c−type−conversion, 3−54−−no−implicit−include, 3−55−−no−implicit−typename, 3−56−−no−inlining, 3−60−−no−line−commands, 3−72−−no−long−preserving−rules, 3−67−−no−namespaces, 3−69−−no−nonconst−ref−anachronism,3−73−−no−nonstd−qualifier−deduction,3−74−−no−nonstd−using−decl, 3−75−−no−old−specializations, 3−80−−no−preproc−only, 3−76−−no−remove−unneeded−entities,3−91−−no−rtti, 3−92−−no−special−subscript−cost, 3−94−−no−tsw−diagnostics, 3−101−−no−typename, 3−102−−no−use−before−set−warnings, 3−77−−no−using−std, 3−107−−no−variadic−macros, 3−108−−no−warnings, 3−78−−no−wchar_t−keyword, 3−110−−no−wrap−diagnostics, 3−111−−nonconst−ref−anachronism, 3−73−−nonstd−qualifier−deduction, 3−74−−nonstd−using−decl, 3−75−−old−for−init, 3−70−−old−line−commands, 3−79−−old−specializations, 3−80−−old−style−preprocessing, 3−81−−one−instantiation−per−object, 3−82−−output, 3−83−−pch, 3−84−−pch−dir, 3−85−−pch−messages, 3−86−−pch−verbose, 3−87−−pending−instantiations, 3−88−−preprocess, 3−89−−remarks, 3−90−−remove−unneeded−entities, 3−91−−rtti, 3−92−−short−lifetime−temps, 3−66−−signed−chars, 3−93−−special−subscript−cost, 3−94−−strict, 3−95−−strict−warnings, 3−95−−suppress−typeinfo−vars, 3−96−−suppress−vtbl, 3−97−−sys−include, 3−98−−timing, 3−99−−trace−includes, 3−100−−tsw−diagnostics, 3−101−−typename, 3−102−−undefine, 3−103−−unsigned−chars, 3−105−−use−pch, 3−106−−using−std, 3−107−−variadic−macros, 3−108−−version, 3−109−−wchar_t−keyword, 3−110−−wrap−diagnostics, 3−111−−xref, 3−112−A, 3−95−a, 3−95−B, 3−55−b, 3−26−C, 3−28−D, 3−31−E, 3−89−e, 3−41••••••••


Index−8IndexINDEX−f, 3−47−H, 3−100−I, 3−58−j, 3−77−L, 3−64−M, 3−32−Mmodel, 3−68−n, 3−71−o, 3−52−P, 3−72−r, 3−90−s, 3−93−T, 3−22−t, 3−61−U, 3−103−u, 3−105−V, 3−109−v, 3−109−w, 3−78−X, 3−112−x, 3−43detailed description, 3−16overview, 3−3overview in functional order, 3−10priority, 3−3output file, 3−52, 3−83overview, 1−1Ppch modeautomatic, 2−38, 3−84manual, 2−42, 3−30, 3−106pragmacan_instantiate, 2−33, 3−116do_not_instantiate, 2−32, 3−116hdrstop, 2−38, 2−43, 3−116ident, 3−117instantiate, 2−32, 3−116no_pch, 2−43, 3−116once, 3−116pragmas, 3−116precompiled header, 2−38automatic, 2−38, 3−84create, 2−42, 3−30directory, 2−42, 2−43, 3−85file cannot be used, 3−87manual, 2−42messages, 3−86performance, 2−44pragmas, 2−43prefix, 2−41use, 2−42, 3−106predefined macros, 2−36predefined symbols, 3−103prelinker, 1−5, B−3prelinker prelk166, 2−29Qqualifier deduction, 3−74Rraw listing, 3−64remark, 4−3remarks, 3−90return values, 4−6run−time type information, 3−92Ssignals, 4−6stack, 2−26STLport library, 2−3string literals, const, 3−29suffix, include file, 3−115symbols, predefined, 3−103syntax checking, 3−71


IndexIndex−9system include directory, 3−98, 3−115typename keyword, 3−102Ttemplate, 2−26distinct signatures, 3−35guiding declarations, 3−53specialization, 3−80template instantiation, 2−26#pragma directives, 2−32automatic, 2−27, 3−22directory, 3−63implicit inclusion, 2−35, 3−55instantiation modes, 2−31, 3−61one file per object, 3−82pending, 3−88temporary files, setting directory, 1−8tie−breakers, 3−37timing information, 3−99tool chain, 1−4muncher, 1−7prelinker, 1−5type information, 3−96Uusing declaration, allow unqualifiedname, 3−75utilities, B−1muncher, B−5prelinker, B−3Vversion information, 3−109virtual function table, 3−50, 3−97Wwarning, 4−3warnings (suppress), 3−77, 3−78wchar_t keyword, 3−110••••••••


INDEXIndex−10Index

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!