OOFILE | Downloads | Purchasing | Press | Services | Company Information | Soapbox | References | F.A.Q. | HOME

OOFILE Support for ANSI iostreams

Due to the range of compilers supported, OOFILE must retain support for the older iostreams.

The #define OOF_USE_ANSI_STREAMS is used to control this support.

If you define this in advance, in a makefile or IDE setting, it governs whether the source code expects to use the new streams.

If not defined, the compiler version number will govern the setting. It will be assumed that Borland v5, Visual C++ 4.x and CodeWarrior 12 onwards use the new streams.

Typedefs are defined for the older streams to enable consistent use of ostringstream and istringstream in the OOFILE code.

CodeWarrior and Forgetting to change your include paths

If you get an error like the following, you've got include paths pointing at the MSL folders and you've defined OOF_USE_ANSI_STREAMS 0 to disable the new streams.

Error : the file 'strstream.h' cannot be opened
oofios.h line 24 #include <strstream.h>

If you get link errors like the following, you've probably got a c-tree Plus library compiled with the Obsolete ANSI libs and are linking with a project using MSL.

Link Error : undefined '_Stoul' (code) Referenced from 'cndx_atol' in Combined c-tree PPC Referenced from 'LexScan' in Combined c-tree PPC Link Error : undefined '_Stod' (code) Referenced from 'cndx_atof' in Combined c-tree PPC Referenced from 'LexScan' in Combined c-tree PPC Link Error : undefined '_Toupper' (data) Referenced from 'CharComp' in Combined c-tree PPC Referenced from 'ctrt_filcmp' in Combined c-tree PPC


Other Problems with CodeWarrior Pro Release 1

Conflicts with Search Expressions

Due partly to the lack of namespaces, CW Pro DR1 (CW12) may cause the following error:

Error : illegal operand
KD_ExtGroupProfile.cp line 322
DP->L_ID <= mSelectedStrands->L_ID);

or, something like

Error : function call 'searchSelection(bool)' does not match
'searchSelection(dbTable *const , const dbQueryClause &)'
'searchSelection(dbTable *const , const dbQueryClause *)
'KD_ExtGroupProfile.cp line 622 PS->searchSelection( PS->L_ID <= mSelectedOutcomes->L_ID );

probably followed by

Error : illegal operand
utility.h line 49 return ! (y < x);

The cause in both circumstances is code which is attempting to create a search clause and has a dbUshort or similar field on the RHS of the expression. In previous versions, this would invoke the operator<=(long) method and return a dbQueryClause of the appropriate type.

It now appears to match the templated operator<= which is contained in the namespace rel_ops.

We hope to have this situation sorted out by the next CodeWarrior release and are working closely with Metrowerks as they add suitable features to the compiler.

In the meantime, use the value() function on the RHS of the search, converting:

PS->searchSelection( PS->L_ID <= mSelectedOutcomes->L_ID );

to

PS->searchSelection( PS->L_ID <= mSelectedOutcomes->L_ID.value() );

 

Necessary Bug Fix to MSL sources sstream.h

Courtesy of one of our users (posted to the Newsgroup: comp.sys.mac.programmer.codewarrior) jesjones@halcyon.com (Jesse Jones)

I'm getting a double delete when using ostringstream. The pointer being doubly deleted is a basic_stringbuf member called tmp. This is allocated in basic_stringbuf::overflow and deleted in the dtor. This is fine and dandy except that overflow() also assigns tmp to it's inherited pbeg and gbeg members (via setp() and setg(). And basic_stringbuf::clean_string deletes pbeg and gbeg. Since clean_string() is called from the basic_stringbuf dtor we wind up with the double delete.

The work around I came up with is to add the following to the start of the basic_stringbuf dtor and to overflow() (before deleting tmp):

if (tmp == eback() || tmp == pbase())

tmp = nil; // ´´´ clean_string() will delete the memory JDJ

 


Feature index

(c) Copyright A.D. Software 1994-2000 (All Rights Reserved).
Last Updated: 9th September 2001