[comp.sys.amiga.programmer] C++

ahinds@hcunix.haverford.edu (Alexander Hinds) (04/09/91)

	I just bought the Lattice C ++ compiler.  However, I consider
a tad bit SLOW for serious work.  Also, the unavailability of a debugger
is annonying.  (I refuse to purchase SAS C just to get CodeProbe.)
	I haven't heard of another C++ compiler.  Is there one?  What
about g++ or gcc++ or whatever it's called?
	Does anybody have a bug list they could send me concerning
Lattice C++?  Is there a more recent version than version one?  Is
anybody actually using it? Lastly, is there a way to link files
produced by Aztec C 5.?? to Lattice C++ object files? 
	Thanks for any help.

Alexander Hinds
A_HINDS@HVRFORD 

davidm@uunet.UU.NET (David S. Masterson) (04/10/91)

>>>>> On 8 Apr 91 19:52:43 GMT, ahinds@hcunix.haverford.edu (Alexander Hinds)
>>>>> said:

Alexander> I just bought the Lattice C++ compiler.  However, I consider a tad
Alexander> bit SLOW for serious work.  Also, the unavailability of a debugger
Alexander> is annonying.  (I refuse to purchase SAS C just to get CodeProbe.)

Lattice C++ was a port of AT&T C++ 1.2 compiler to the Amiga and, so, is just
a translator rather than a direct to object file compiler.  It comes with an
older version of the Lattice C compiler (v4.2?) that the C++ translator uses
on the back end.  Obviously, that will make it somewhat slower than just a
straight compiler would be.  I understand that it can use the newer versions
of SAS C, but you pay for the upgrade of the C compiler.  Given that its only
based on C++ 1.2, I haven't felt the need to buy it.

Alexander> I haven't heard of another C++ compiler.  Is there one?  What about
Alexander> g++ or gcc++ or whatever it's called?

I think some group was interested in doing a port of G++ to the Amiga, but
they first needed to get GCC & GAS (etc.) in place.  I think they've
accomplished this, but the environment chews up lots of memory.

Comeau Computing (718-945-0009) has recently announced a port of AT&T C++ 2.1
(not 1.2) to the Amiga that is also a translator and will use a number of
Amiga C compilers in the backend.  Right now, they have it working with the
current version of SAS C, but they have plans of getting it out for other
compilers (Aztec, DICE, PDC) sometime this quarter.  They need to develop a
portable preprocessor for their C++ compiler first.  I'm waiting for the Aztec
version of this.

I have heard rumors (?) that SAS will have a C++ compiler (not translator) for
C++ 2.0 sometime soon (if not already).  I don't know about upgrade plans.

All this should be going well by summer if you can wait till then.  
--
====================================================================
David Masterson					Consilium, Inc.
(415) 691-6311					640 Clyde Ct.
uunet!cimshop!davidm				Mtn. View, CA  94043
====================================================================
"If someone thinks they know what I said, then I didn't say it!"

comeau@ditka.Chicago.COM (Greg Comeau) (04/11/91)

In article <ahinds.671140363@hcunix.haverford.edu> ahinds@hcunix.haverford.edu (Alexander Hinds) writes:
>
>	I just bought the Lattice C ++ compiler.  However, I consider
>a tad bit SLOW for serious work.  Also, the unavailability of a debugger
>is annonying.  (I refuse to purchase SAS C just to get CodeProbe.)

I'm a bit confused by your comment since to use Lattice C++, you need
Lattice C and if you've done that, you should have CPR (I have heard from
various source that CPR won't work with Lattice C++ anyway --
personally, I'm not sure how that can be but that's what I've been told.

>	I haven't heard of another C++ compiler.  Is there one?  What
>about g++ or gcc++ or whatever it's called?

There is only one that I know about, which is ours: Comeau C++.

>	Does anybody have a bug list they could send me concerning
>Lattice C++?  Is there a more recent version than version one?  Is
>anybody actually using it? Lastly, is there a way to link files
>produced by Aztec C 5.?? to Lattice C++ object files? 

I think a few things need to be mentioned here: Lattice C++ is an old
product (4 years??) that wasn't even developed/ported by Lattice/SAS and
has not been upgraded in about that long as well.  So even if there was
a bug list, it probably wouldn't get you too far.

Re Aztec/lattice link compatibility: even at the C level this is
bext avoided and should be considered in general not possible.

- Greg
-- 
	 Comeau Computing, 91-34 120th Street, Richmond Hill, NY, 11418
                            Producers of Comeau C++
          Here:attmail.com!csanta!comeau / BIX:comeau / CIS:72331,3421
                     Voice:718-945-0009 / Fax:718-441-2310

mr3@ukc.ac.uk (M.Rizzo) (04/11/91)

In article <ben.5806@epmooch.UUCP> ben@epmooch.UUCP (Rev. Ben A. Mesander) writes:
>>In article <1991Apr10.000254.24530@mintaka.lcs.mit.edu> rjc@geech.gnu.ai.mit.edu (Ray Cromwell) writes:
>[...]
>>With data abtraction, you can operate on structures and not
>>even know what's inside them!
>
>Hah! I can do this is almost any language! I don't need C++ to help me do
>that!

But the C++ compiler will catch violations and a non-OOP language compiler
won't. Also C++ provides a more natural syntax for describing abstractions.
And member functions of different classes can have the same name (which is
important for polymorphism) - you can't do this in C say.

Anyone got Comeau C++ for the Amiga yet ? Comments ? Also does anyone
know if there are any C++ toolkits for graphical interfaces on the
Amiga i.e. one in which various interface components are represented
by a set of classes, objects of which can easily be composed together
to build interfaces (something like InterViews for X) ?

Michael Rizzo

comeau@ditka.Chicago.COM (Greg Comeau) (04/11/91)

In article <CIMSHOP!DAVIDM.91Apr9112538@uunet.UU.NET> cimshop!davidm@uunet.UU.NET (David S. Masterson) writes:
>Lattice C++ was a port of AT&T C++ 1.2 compiler to the Amiga and, so, is just
>a translator rather than a direct to object file compiler.

It's not "just a translator"! ;-)  It does complete compiler duties (error
checking, syntax checking, semantics of C++, etc) building internal trees
looking nothing like C or C++.  It just so happens that in the code generation
phase it outputs C as its object code depending upon the C compiler only for
the native object code generation.

>Comeau Computing (718-945-0009) has recently announced a port of AT&T C++ 2.1
>...  Right now, they have it working with the
>current version of SAS C, but they have plans of getting it out for other
>compilers (Aztec, DICE, PDC) sometime this quarter.  They need to develop a
>portable preprocessor for their C++ compiler first.

This is true.

Re the preprocessor, for those who do not want to wait,
using the preprocessor that comes with DICE should be a viable route
to take.  We did not realize DICE had this until only a few days ago.

>I have heard rumors (?) that SAS will have a C++ compiler (not translator) for
>C++ 2.0 sometime soon (if not already).  I don't know about upgrade plans.

That appears true as well.

Alledgedly SAS is working on a C++.  When we will see it, I do not know.
It should prove an interesting time for all though!

- Greg
-- 
	 Comeau Computing, 91-34 120th Street, Richmond Hill, NY, 11418
                            Producers of Comeau C++
          Here:attmail.com!csanta!comeau / BIX:comeau / CIS:72331,3421
                     Voice:718-945-0009 / Fax:718-441-2310

jleonard@pica.army.mil (04/12/91)

In article <7257@harrier.ukc.ac.uk> mr3@ukc.ac.uk (M.Rizzo) writes:
 
>[in C++] member functions of different classes can have the same name (which 
>is important for polymorphism) - you can't do this in C say.
                                  --------------------------- (emphasis mine)

Although it requires some sleight of hand you can implement classes in C in 
such a way that member functions can effectively have the same name and allow
overloading.

All you have to do is use structures containing your classes data and member
function pointers.  This way you can give the function a name in the structure 
and then initialise the function pointer to point to your member function
(possibly a different function for every instance of the class).

e.g.

typedef struct
{
	Treenode *root;
	Treenode *(*left_child)();
	Treenode *(*right_child)();
	Treenode *(*insert)();
	Treenode *(*remove)();
} BINARY_TREE;

BINARY_TREE red_black =
{
	(Treenode *)NULL,l_child,r_child,rb_insert,rb_remove
};

BINARY_TREE binary_tree =
{
	(Treenode *)NULL,l_child,r_child,binary_insert,binary_remove
};

and so on...

I'm not saying everyone should do this (remember the right tool for the job)
but it can be done.

						Jeff Leonard

ben@epmooch.UUCP (Rev. Ben A. Mesander) (04/13/91)

>In article <36771@ditka.Chicago.COM> comeau@ditka.Chicago.COM (Greg Comeau) writes:
>In article <7257@harrier.ukc.ac.uk> mr3@ukc.ac.uk (M.Rizzo) writes:
>>In article <ben.5806@epmooch.UUCP> ben@epmooch.UUCP (Rev. Ben A. Mesander) writes:
>>>>In article <1991Apr10.000254.24530@mintaka.lcs.mit.edu> rjc@geech.gnu.ai.mit.edu (Ray Cromwell) writes:
>>>>With data abtraction, you can operate on structures and not
>>>>even know what's inside them!
>>>Hah! I can do this is almost any language! I don't need C++ to help me do
>>>that!
>>But the C++ compiler will catch violations and a non-OOP language compiler
>>won't. Also C++ provides a more natural syntax for describing abstractions.
>>And member functions of different classes can have the same name (which is
>>important for polymorphism) - you can't do this in C say.
>
>Exactly.
>
>And that's only a sampling!

Uh, before you guys take this too seriously, my original posting was a
*joke*. Yes Virginia, in any language, it is possible to operate on the
contents of structures without knowing what was in them -- inadvertantly.

Glad to know it's a *feature* of C++!

(close :-) for the humour impaired)

--
| ben@epmooch.UUCP   (Ben Mesander)       | "Cash is more important than |
| ben%servalan.UUCP@uokmax.ecn.uoknor.edu |  your mother." - Al Shugart, |
| !chinet!uokmax!servalan!epmooch!ben     |  CEO, Seagate Technologies   |

comeau@ditka.Chicago.COM (Greg Comeau) (04/13/91)

In article <7257@harrier.ukc.ac.uk> mr3@ukc.ac.uk (M.Rizzo) writes:
>In article <ben.5806@epmooch.UUCP> ben@epmooch.UUCP (Rev. Ben A. Mesander) writes:
>>>In article <1991Apr10.000254.24530@mintaka.lcs.mit.edu> rjc@geech.gnu.ai.mit.edu (Ray Cromwell) writes:
>>>With data abtraction, you can operate on structures and not
>>>even know what's inside them!
>>Hah! I can do this is almost any language! I don't need C++ to help me do
>>that!
>But the C++ compiler will catch violations and a non-OOP language compiler
>won't. Also C++ provides a more natural syntax for describing abstractions.
>And member functions of different classes can have the same name (which is
>important for polymorphism) - you can't do this in C say.

Exactly.

And that's only a sampling!

This also starts getting into issue of what natural support of programming
features is all about.

>Also does anyone know if there are any C++ toolkits for graphical interfaces
>on the Amiga ...

As far as I know the answer is an overwhelming: no.

I do think we will be seeing that change though.

-- 
	 Comeau Computing, 91-34 120th Street, Richmond Hill, NY, 11418
                            Producers of Comeau C++
          Here:attmail.com!csanta!comeau / BIX:comeau / CIS:72331,3421
                     Voice:718-945-0009 / Fax:718-441-2310

comeau@ditka.Chicago.COM (Greg Comeau) (04/15/91)

In article <50511@nigel.ee.udel.edu> jleonard@pica.army.mil writes:
>In article <7257@harrier.ukc.ac.uk> mr3@ukc.ac.uk (M.Rizzo) writes:
> 
>>[in C++] member functions of different classes can have the same name (which 
>...All you have to do is use structures containing your classes data and member
>function pointers.  This way you can give the function a name in the structure 

One can most certainly emulate many of C++ features in C.
That misses the point though.

The goal is to strive for a natural an integration as possible.  Your
C solution does not do that.  The C++ way is "just there" and simple
to use.  So long as the C++ way is like that and available, seems the
slight of hand C alternative is greatly inferior.


- Greg
-- 
	 Comeau Computing, 91-34 120th Street, Richmond Hill, NY, 11418
                            Producers of Comeau C++
          Here:attmail.com!csanta!comeau / BIX:comeau / CIS:72331,3421
                     Voice:718-945-0009 / Fax:718-441-2310

jleonard@pica.army.mil (04/16/91)

----- Begin Included Message -----

From @aed,@louie.udel.edu:mmdf@udel.edu Mon Apr 15 15:14:28 1991
From: Greg Comeau <comeau@ditka.chicago.com>
Newsgroups: comp.sys.amiga.programmer
Subject: Re: C++
Message-Id: <36852@ditka.Chicago.COM>
Date: 15 Apr 91 06:17:45 GMT
Organization: Comeau Computing
To: amiga-programmer-relay@udel.edu
Sender: amiga-programmer-relay-request@udel.edu

>In article <36852@ditka.Chicago.COM> comeau@ditka,chicago.com writes:
>>In article <50511@nigel.ee.udel.edu> jleonard@pica.army.mil writes:
>>>In article <7257@harrier.ukc.ac.uk> mr3@ukc.ac.uk (M.Rizzo) writes:
> 
>>>[in C++] member functions of different classes can have the same name (which 
>>>is important for polymorphism) - you can't do this in C say.
>>                                  ---------------------------
>>..All you have to do is use structures containing your classes data and member
>>function pointers.  This way you can give the function a name in the structure 

>One can most certainly emulate many of C++ features in C.
>That misses the point though.

Actually I was just pointing out that it is possible to do overloading in C,
since the post I replied to said it couldn't be done.  I didn't intend to
imply that C is suitable for object oriented programming.

>- Greg

Jeff Leonard                                

es1@cunixb.cc.columbia.edu (Ethan Solomita) (04/16/91)

In article <36852@ditka.Chicago.COM> comeau@csanta.attmail.com (Greg Comeau) writes:
>The goal is to strive for a natural an integration as possible.  Your
>C solution does not do that.  The C++ way is "just there" and simple
>to use.  So long as the C++ way is like that and available, seems the
>slight of hand C alternative is greatly inferior.
>
>
	But it would seem to be very hard to optimize the C code
generated by C++, as compared to writing the C code directly. It
isn't like you can write in C++, translate to C, and then muck
around easily in the C code, not that even doing that would be
optimal. I don't know too much about C++, but I do remember
something about name mangling which would drive me up the wall.
	So, how does optimization of code compare?

>- Greg
>-- 
>	 Comeau Computing, 91-34 120th Street, Richmond Hill, NY, 11418
>                            Producers of Comeau C++
>          Here:attmail.com!csanta!comeau / BIX:comeau / CIS:72331,3421
>                     Voice:718-945-0009 / Fax:718-441-2310


	-- Ethan

Q: How many Comp Sci majors does it take to change a lightbulb
A: None. It's a hardware problem.

comeau@ditka.Chicago.COM (Greg Comeau) (04/17/91)

In article <ben.5918@epmooch.UUCP> ben@epmooch.UUCP (Rev. Ben A. Mesander) writes:
>>In article <36771@ditka.Chicago.COM> comeau@ditka.Chicago.COM (Greg Comeau) writes:
>>In article <7257@harrier.ukc.ac.uk> mr3@ukc.ac.uk (M.Rizzo) writes:
>>>In article <ben.5806@epmooch.UUCP> ben@epmooch.UUCP (Rev. Ben A. Mesander) writes:
>>>>>In article <1991Apr10.000254.24530@mintaka.lcs.mit.edu> rjc@geech.gnu.ai.mit.edu (Ray Cromwell) writes:
>>>>>With data abtraction, you can operate on structures and not
>>>>>even know what's inside them!
>>>>Hah! I can do this is almost any language! I don't need C++ to help me do
>>>But the C++ compiler will catch violations and a non-OOP language compiler
>>Exactly.  And that's only a sampling!
>Uh, before you guys take this too seriously, my original posting was a *joke*.

Be as that may, *do* take it seriously as even though you've lucked out
in your comment, your mention of "Also C++ provides a more natural syntax for
describing abstractions.  And member functions of different classes can have
the same name (which is important for polymorphism) - you can't do this in C
say." is right on target.

There is a lot the same, but there is also a lot different in addressing
theses types of issues with C++.

-- Greg
-- 
	 Comeau Computing, 91-34 120th Street, Richmond Hill, NY, 11418
                            Producers of Comeau C++
          Here:attmail.com!csanta!comeau / BIX:comeau / CIS:72331,3421
                     Voice:718-945-0009 / Fax:718-441-2310

comeau@ditka.Chicago.COM (Greg Comeau) (04/18/91)

In article <1991Apr15.222555.24808@cunixf.cc.columbia.edu> es1@cunixb.cc.columbia.edu (Ethan Solomita) writes:
>In article <36852@ditka.Chicago.COM> comeau@csanta.attmail.com (Greg Comeau) writes:
>>The goal is to strive for a natural an integration as possible.  Your
>>C solution does not do that.  The C++ way is "just there" and simple
>>to use.  So long as the C++ way is like that and available, seems the
>>slight of hand C alternative is greatly inferior.
>>
>	But it would seem to be very hard to optimize the C code
>generated by C++, as compared to writing the C code directly. It
>isn't like you can write in C++, translate to C, and then muck
>around easily in the C code, not that even doing that would be
>optimal.

A common saying in C++ circles is that "You don't pay for what you don't use.".
I usually add on to that and say "... and even when you do use it, you
don't pay).

The results I have received from both formal and informal research,
speaking with literally thousands of C and C++ programmers, my own toying
and experience has amply and overwhelmingly  demonstrated that a C++
translating compiler has no penalty in terms of your executable quality.

Right, you don't need to muck around in the C, now should you have to.
Just like you normally wouldn't muck around in the asm generated from
your C compiler.

- Greg
-- 
	 Comeau Computing, 91-34 120th Street, Richmond Hill, NY, 11418
                            Producers of Comeau C++
          Here:attmail.com!csanta!comeau / BIX:comeau / CIS:72331,3421
                     Voice:718-945-0009 / Fax:718-441-2310

daveh@cbmvax.commodore.com (Dave Haynie) (04/23/91)

In article <36711@ditka.Chicago.COM> comeau@csanta.attmail.com (Greg Comeau) writes:
>In article <CIMSHOP!DAVIDM.91Apr9112538@uunet.UU.NET> cimshop!davidm@uunet.UU.NET (David S. Masterson) writes:
>>Lattice C++ was a port of AT&T C++ 1.2 compiler to the Amiga and, so, is just
>>a translator rather than a direct to object file compiler.

>It's not "just a translator"! ;-)  It does complete compiler duties (error
>checking, syntax checking, semantics of C++, etc) building internal trees
>looking nothing like C or C++.  It just so happens that in the code generation
>phase it outputs C as its object code depending upon the C compiler only for
>the native object code generation.

Sure sounds like the classical definition of "translator" to me.  For those
who haven't taken a compiler design course, you all should know that all
compilers are also "translators".  If a translator takes in some HLL, and spits
out object code, it's a compiler.  If not, it is some other kind of translator.
I think there's some general suspicion that because most C++ compilers involve
a two stage compilation process, that there's something wrong with them.  There
isn't, the only real problem going from C++ -> C -> QUAD -> Object, as with
Lattice C++, is that the extra lexical analysis passes burn more CPU time than
a direct C++ to object translator would like do.  Other than that, there should
not be any difference.

>>Comeau Computing (718-945-0009) has recently announced a port of AT&T C++ 2.1

>This is true.

And that sounds like something I'm REAL interest in.  I really want to program
in C++, but gave up on Lattice C++ 1.0 for the most part, mainly because of its
lack of source level debugging.  All that crashing on syntax errors didn't help
either.

>- Greg

-- 
Dave Haynie Commodore-Amiga (Amiga 3000) "The Crew That Never Rests"
   {uunet|pyramid|rutgers}!cbmvax!daveh      PLINK: hazy     BIX: hazy
      "That's me in the corner, that's me in the spotlight" -R.E.M.

tron1@tronsbox.xei.com (Kenneth Jamieson) (04/23/91)

In article <20860@cbmvax.commodore.com> daveh@cbmvax.commodore.com (Dave Haynie) writes:
>
>Sure sounds like the classical definition of "translator" to me.  For those
>who haven't taken a compiler design course, you all should know that all
>compilers are also "translators".  If a translator takes in some HLL, and spits

	Well, as long as you stick to that definition ... your right.

>
>>>Comeau Computing (718-945-0009) has recently announced a port of AT&T C++ 2.1
>
>>This is true.
>
>And that sounds like something I'm REAL interest in.  I really want to program
>in C++, but gave up on Lattice C++ 1.0 for the most part, mainly because of its
>lack of source level debugging.  All that crashing on syntax errors didn't help
>either.

	Well.. this is it (for a while anyway .. my confidence level
withc SAS is great for support, low for new products)...

	This is ROCK solid, and a real 2.1 (for amiga specific class
libraries... watch this space....)


-- 
========[ Xanadu Enterprises Inc. Amiga & Unix Software Development]=======
= "I know how you feel, you don't know if you want to hit me or kiss me - =
=  --- I get a lot of that."  Madonna as Breathless Mahoney (Dick Tracy)  =
=========== Ken Jamieson: uunet!tronsbox.xei.com!tron1  ===================
=     NONE of the opinions represented here are endorsed by anybody.      =
=  Unix is (tm) AT&T, Amiga is (tm) Commodore Business Machines, and all  =
=  characters from Dick Tracy are (tm) Warner Bros.                       =
===========================================================================

davidm@uunet.UU.NET (David S. Masterson) (04/24/91)

>>>>> On 22 Apr 91 22:29:11 GMT, daveh@cbmvax.commodore.com (Dave Haynie) said:

Dave> In article <36711@ditka.Chicago.COM> comeau@csanta.attmail.com (Greg
Dave> Comeau) writes:

Greg> In article <CIMSHOP!DAVIDM.91Apr9112538@uunet.UU.NET>
Greg> cimshop!davidm@uunet.UU.NET (David S. Masterson) writes:

David> Lattice C++ was a port of AT&T C++ 1.2 compiler to the Amiga and, so,
David> is just a translator rather than a direct to object file compiler.

Greg> It's not "just a translator"! ;-) It does complete compiler duties
Greg> (error checking, syntax checking, semantics of C++, etc) building
Greg> internal trees looking nothing like C or C++.  It just so happens that
Greg> in the code generation phase it outputs C as its object code depending
Greg> upon the C compiler only for the native object code generation.

Dave> Sure sounds like the classical definition of "translator" to me.  For
Dave> those who haven't taken a compiler design course, you all should know
Dave> that all compilers are also "translators".  If a translator takes in
Dave> some HLL, and spits out object code, it's a compiler.  If not, it is
Dave> some other kind of translator.  

Now, now.  Greg was making the point that, in the case of C++ "translators",
they spit object code.  Its just that the object code is C.  Now are you going
to turn around and define object code?  :-)

David> Comeau Computing (718-945-0009) has recently announced a port of AT&T
David> C++ 2.1

Greg> This is true.

Dave> And that sounds like something I'm REAL interest in.  I really want to
Dave> program in C++, but gave up on Lattice C++ 1.0 for the most part, mainly
Dave> because of its lack of source level debugging.  All that crashing on
Dave> syntax errors didn't help either.

This is something that I haven't seen a "definitive" answer to, yet.  What are
the capabilities of source level debugging this C++ with a C compiler's source
level debugger (CPR or SDB).  I believe (correct me if I'm wrong) that you
might have the capability to step through your code statement by statement,
but it might be more difficult to find the value of a variable (unless you
remember how name mangling works).
--
====================================================================
David Masterson					Consilium, Inc.
(415) 691-6311					640 Clyde Ct.
uunet!cimshop!davidm				Mtn. View, CA  94043
====================================================================
"If someone thinks they know what I said, then I didn't say it!"