Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!autodesk!glang From: glang@Autodesk.COM (Gary Lang) Newsgroups: comp.sys.next Subject: Re: C++ and -- Bug report Message-ID: <2422@autodesk.COM> Date: 1 Feb 91 04:55:35 GMT References: <1991Jan28.134211.1497@engage.enet.dec.com> Distribution: comp Organization: Autodesk Inc., Sausalito CA, USA Lines: 60 In-reply-to: tenny@ootool.dec.com's message of 28 Jan 91 13:33:57 GMT >>NeXT uses the C++ reserved word 'new' in stdio.h!!!!! I can't believe >>NeXT didn't catch this!!! Arrggh. I guess no one at NeXT actually >>uses C++. >I'd like C++ too for my NeXT. But I'm not holding my breath for it. >Even when I get 2.0, I know that G++ 1.37.1 has lots of bugs, and I've This is not a problem with NeXT's stdio.h. This is your problem. This happens with any mixed language environment. In fact there's a provision for it that's supported with the cc++ compiler. Just declare the language that a piece of code uses to the compiler. For example, in your case... extern "C" { #import } Works like a champ. Similarly for objc headers... extern "Objective-C" { #import } One thing I found out that annoyed me was that id is not declared the same type as Object *...so if you have code like any good programmer should that looks like: self = [ Foo new ]; if ( self == nil ) errorDoSomething(); It will complain because self and nil aren't the same type (class) either directly nor transitively in the class hierarchy. id is a typedef of ther struct objc_object, which has the same structure as the Object class definition, but isn't defined as the latter, and so cc++ complains... Since I code for portability, I never directly include because I'd never place StepStone's headers in such a place; /usr/include belongs to my compiler on other platforms, and upgrading the compiler runs the risk of overwriting any clones of the NeXT directory structure I could come up with. So instead I have a local header I call objc.cf which, depending on which compiler/platform I'm on includes the correct objc.h. It also includes the Object category I defined to emulate the missing StepStone Object interface. So all I had to do was under nil and define it correctly. Good luck. -g -- Gary T. Lang (415)332-2344 x2702 Autodesk, Inc. Sausalito, CA. MCI: 370-0730