MFC Programmer's SourceBook : Thinking in C++
Bruce Eckel's Thinking in C++, 2nd Ed Contents | Prev | Next

E:Compiler specifics

This appendix contains the compiler information database which is used by the automatic code extraction program ExtractCode.cpp to build makefiles that will work properly with the various compilers.

The explanation for this database format is found in the description of ExtractCode.cpp in Chapter 23. The information about files that won’t compile, along with the data for commercial compilers, is removed from the published version, and only the online version at http://www.BruceEckel.com (along with the source code file at that location) will contain that data (since it will be subject to change as new compilers are added and as bugs are removed).

#: :CompileDB.txt
# Compiler information listings for Thinking in 
# C++ 2nd Edition By Bruce Eckel. See copyright 
# notice in Copyright.txt.
# This is used by ExtractCode.cpp to generate the
# makefiles for the book, including the command-
# line flags for each vendor's compiler and 
# linker. Following that are the code listings 
# from the book that will not compile for each 
# compiler. The listings are, to the best of my 
# knowledge, correct Standard C++ (According to 
# the Final Draft International Standard). Please
# note that the tests were performed with the 
# most recent compiler that I had at the time, 
# and may have changed since this file was 
# created.
# After ExtractCode.cpp creates the makefiles
# for each chapter subdirectory, you can say 
# "make egcs", for example, and all the programs
# that will successfully compile with egcs will
# be built.
#################################################
# Compiling all files, for a (theoretical) fully-
# conformant compiler. This assumes a typical
# compiler under dos:
{ all }
# Object file name extension in parentheses:
(obj)
# Executable file extension in square brackets:
[exe]
# The leading '&' is for special directives. The
# dos directive means to replace '/' 
# with '\' in all directory paths:
&dos
# The following lines will be inserted directly
# into the makefile (sans the leading '@' sign)
# If your environment variables are set to 
# establish these you won't need to use arguments
# on the make command line to set them:
# CPP: the name of your C++ compiler
# CPPFLAGS: Compilation flags for your compiler
# OFLAG: flag to give the final executable name
#@CPP = yourcompiler
#@CPPFLAGS =
#@OFLAG = -e
@.SUFFIXES : .obj .cpp .c
@.cpp.obj :
@   $(CPP) $(CPPFLAGS) -c $<
@.c.obj :
@   $(CPP) $(CPPFLAGS) -c $<
# Assumes all files will compile
# See later for an example of unix configuration
#################################################"CompileDB">
# Borland C++ Builder 4
# Target name used in makefile:
{ Borland }
# Object file name extension in parentheses:
(obj)
# Executable file extension in square brackets:
[exe]
# The leading '&' is for special directives. The
# dos directive means to replace '/' 
# with '\' in all directory paths:
&dos
# Inserted directly into the makefile (without
# the leading '@' sign):
@CPP = Bcc32
@CPPFLAGS = -w-inl -w-csu
@OFLAG = -e
@.SUFFIXES : .obj .cpp .c
@.cpp.obj :
@   $(CPP) $(CPPFLAGS) -c $<
@.c.obj :
@   $(CPP) $(CPPFLAGS) -c $<
# Problem with string constructors:
C17:StringIterators.cpp
# Causes an unresolved external:
C17:ICompare.cpp
# Template bug:
C19:ArraySize.cpp
# Bitset is Broken in this compiler’s library:
C20:BitSet.cpp
# Not sure what the problem is here:
C20:ListRobustness.cpp
C20:BasicSequenceOperations.cpp
# Problem with vector.cc
C20:VectorCoreDump.cpp
# bitset::bitset(string) missing:
C20:VectorOfBool.cpp
# compiler strangeness:
C20:AssocInserter.cpp
# Problem with templates?
C21:FunctionObjects.cpp
# Problem with the algorithms
C21:PtrFun1.cpp
C21:PtrFun2.cpp
C21:MemFun1.cpp
C21:SearchReplace.cpp
# Function-level try blocks not implemented:
C23:FunctionTryBlock.cpp
# Uses the SGI STL extensions, so it actually 
# isn't supposed to compile with this 
# compiler:
C20:MapVsHashMap.cpp
C21:MemFun4.cpp
C21:Compose2.cpp
#################################################
# The egcs (Experimental g++ compiler) snapshot 
# under Linux:
{ egcs }
(o)
[]
# The unix directive controls the way some of the
# makefile lines are generated:
&unix
@CPP = g++
@OFLAG = -o
@.SUFFIXES : .o .cpp .c
@.cpp.o :
@   $(CPP) $(CPPFLAGS) -c $<
@.c.o :
@   $(CPP) $(CPPFLAGS) -c $<
# Files that won't compile
# Error in streambuf.h:
C18:Cppcheck.cpp
# A basic compiler bug
C20:BankTeller.cpp
# Problem with the egcs iterator header
C20:StreambufIterator.cpp
C20:RawStorageIterator.cpp
# egcs is missing istreambuf_iterator
C20:WordList2.cpp
C20:TokenizeTest.cpp
C20:TokenIteratorTest.cpp
C20:WordCount.cpp
C20:MultiSetWordCount.cpp
C21:SortTest.cpp
C21:SortedSearchTest.cpp
# egcs is missing std::iterator:
C20:Ring.cpp
# egcs is missing char_traits
C17:ICompare.cpp
# egcs vector and deque (at least) are missing
# the "at()" functions:
C20:IndexingVsAt.cpp
# There’s a problem with the egcs string class:
C17:Compare2.cpp
# Problem with egcs priority_queue:
C20:PriorityQueue4.cpp
C20:PriorityQueue8.cpp
# Broken in this compiler’s library:
C20:BitSet.cpp
# These are because <sstream> isn’t implemented
C18:NumberPhotos.cpp
C20:StringVector.cpp
C20:FEditTest.cpp
C20:StringDeque.cpp
C20:VectorOfBool.cpp
C20:WildLifeMonitor.cpp
# The end tag is required:
#///:~

Contents | Prev | Next


Go to CodeGuru.com
Contact: webmaster@codeguru.com
© Copyright 1997-1999 CodeGuru