🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.mac.oop.macapp3
3 messages
3 total messages Started by Personal Software, Alan Dail,PRT Sun, 24 Jan 1993 01:50
C++ (was re: bedrock defection
#329
Author: Personal Software, Alan Dail,PRT
Date: Sun, 24 Jan 1993 01:50
23 lines
1585 bytes
Larry,
 
>...as safe as Pascal.... MPW C++ may not catch as many errors as it should,
>but that's a compiler problem, not a language problem.
 
I would tend to disagree.  C and C++ both allow so many things to compile that
could easily be typos but cause the program to do the wrong thing (I do admit
that C++ is better than C).  For example, anywhere you can use a ==, you can
also use = (and vice versa) and have the program compile fine (due to the
definition of the language), but get different results.  Your program will not
only compile, but may even work fine in some instances.  It doesn't even stand
out when you are looking over your code.  This error would be cought in Pascal
(or even in Pascal '9x), but not in C or C++.
 
There are other many other problems like this that are part of the language and
not due to the compiler.  This doesn't even address the other language problems
like having various features clash when used together or having the wrong
defaults when using features (why isn't virtual the default?).  It's a shame
that Apple doesn't appear to be doing anything with Pascal '9x which appears to
give programmers the power of C++ without nearly as many pitfalls.
 
Alan
 
Re: C++ (was re: bedrock defection
#335
Author: BoBolicious
Date: Sun, 24 Jan 1993 22:19
38 lines
2783 bytes
In article <727841301.8123714@AppleLink.Apple.COM> ALANDAIL@AppleLink.Apple.COM (Personal Software, Alan Dail,PRT) writes:
>I would tend to disagree.  C and C++ both allow so many things to compile that
>could easily be typos but cause the program to do the wrong thing (I do admit
>that C++ is better than C).  For example, anywhere you can use a ==, you can
>also use = (and vice versa) and have the program compile fine (due to the
>definition of the language), but get different results.  Your program will not
>only compile, but may even work fine in some instances.  It doesn't even stand
>out when you are looking over your code.  This error would be cought in Pascal
>(or even in Pascal '9x), but not in C or C++.

MPW C++ will warn you if you use a "=" inside an if.  The biggest problem
I had switching from C to C++ was that I didn't pay enough attention to
the warnings that CFront emits.  My C code was so "warning-laden" that I
tended to just ignore them, but CFront can be quite helpful.  It could be
better, though, I admit.

>There are other many other problems like this that are part of the language and
>not due to the compiler.  This doesn't even address the other language problems
>like having various features clash when used together or having the wrong
>defaults when using features (why isn't virtual the default?).  It's a shame
>that Apple doesn't appear to be doing anything with Pascal '9x which appears to
>give programmers the power of C++ without nearly as many pitfalls.

Do you have any more examples?  I've found C++ to be an ideal mix of flexible
elegance & stiff type-checking.  The biggest gotcha for me is usually a bad
typecast, which if I understand correctly, Pascal allows as well.  Properly
written C++ code can pretty stable; it took many shots-to-the-foot, for
instance, before I was fully convinced that initializing everything to nil
and then checking everything before using it is truly The Way (tm).

cheers,
bobo              In seeking the unattainable,
bowman@reed.edu            simplicity only gets in the way.
Best personal ad ever:
"Functionally dysfunctional bi-polar former pop-star geek with Valium habit
seeks anorexic queen of darkness for co-dependency.  Hobbies include: passing
out, slurred speech, blurred vision and reliving past glory."
_Willamette Week_, 1/7-13/93
Re: C++ (was re: bedrock defection
#344
Author: Larry Rosenstein
Date: Tue, 26 Jan 1993 02:10
31 lines
1870 bytes
In article <727841301.8123714@AppleLink.Apple.COM>,
ALANDAIL@AppleLink.Apple.COM (Personal Software, Alan Dail,PRT) wrote:
> 
> that C++ is better than C).  For example, anywhere you can use a ==, you can

You're right about this, and I haven't considered these issues.  The == vs.
= problem is a flaw that C++ inherits from C.  The same is true of switch
statements (where leaving out the break in each case is usually a mistake).

As someone mentioned, MPW C++ does warn you about some of these things, and
a better compiler would do a better job of warning you.

> like having various features clash when used together or having the wrong

I think there's a tradeoff here.  You could remove lots of features from
the language, but then there would be useful things that you couldn't do. 
For example, removing stack-based objects would simplify things
considerably, but stack-based objects are useful in many places.

One of the premises behind my MADA Conference talk on C++ is that if you
develop some "rules of thumb" (or "idioms" as James Coplien describes them)
for using C++ then it's much easier to deal with the language.

> defaults when using features (why isn't virtual the default?).  It's a shame

C++ was designed for maximum performance.

Larry Rosenstein
Taligent, Inc.

lsr@taligent.com
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads