From: vincer@iaccess.za (Vince Risi)
Newsgroups: comp.lang.c++
Subject: Re: C vs Pascal
Date: 30 Jan 1996 09:09:29 +0200

In article <310ab831.512924160@news.cyberport.com>,
tangent@cyberport.com (Warren Young) wrote:

> Let's turn the tables, though, and see how many things TP swiped from
> C/C++:
>
> o  Classes (or whatever TP with Objects calls them)

I suspect Object Pascal which precedes TP 5.5 may have "borrowed"
them from Simula (which is where C++ got them too)

> o  Free-form declarations -- standard Pascal requires that your
> declarations be segregated by type, with only one type group at each
> level of scope.

TP or (KomPas) was a renegade here at version 1.0. I wonder if Anders
was aware of C at that time. Certainly C was not ANSI at that
time and C++ was just a twinkle in the Bjarne eye.

> o  Bitwise operators

Bitwise operators precede C.

> o  Separate compilation (UNITs and modules)

C and C++ do not support separate compilation, only independant
compilation. Mores the pity. UCSD Pascal introduced units based
on a 1971 paper on separate versus independant compilation.

> o  Conditional compilation

> What has C/C++ still got that TP doesn't?

> o  Multiple inheritance

Debatable plus.

> o  Variable-length argument lists

Delphi's object pascal supports more than just variable length
argument lists, it supports many variable argument lists. viz.

function Cross(R1, R2 : array of double) : double;
var
  i1, i2 : integer;
begin
  result := 0;
  for i1 := 0 to high(R1) do
    for i2 := 0 to high(R2) do
      result := result + R1[i1] * R2[i2];
end;

...
  Cross1 := Cross([1.0, 2.0, 3.0], [7.2, 7.1, 7.3, 7.7, 9.1]);
  Cross2 := Cross([5.0, 4.0, 3.0, 2.0, 1.0], [7.1, 7.3, 7.7]);
...

> o  Forward references and prototypes.  Functions don't have to be in a
> specific order in C/C++.

The earliest Pascals supported forward references. C++ does not
appreciate undeclared functions at all. It is also bad coding
style to assume undefined variables and functions are int.

> o  A more powerful base language -- Try writing writeln() in Pascal
> sometime.  You can't do it because the language doesn't support vararg
> functions, so the language had to have that function defined into it.
> Same goes for ord() and more.  None of the functions in the C/C++
> standard are built into the language, because they don't have to be.

Check out format in Delphi. A better printf than printf. Typesafe.
Nudge nudge, wink wink, say no more.

> o  Pointer arithmetic -- try writing strcpy() in Pascal.  Or anything
> else that manipulates blocks of memory.  Related to this is that,
> because the size of an array is a part of its type, you can't have
> general-purpose memory-block manipulation routines.

Piece of old tacky. Check out the strings unit for TP6.0 only
4 years old by now.

> And to be fair, there is at least one thing Pascal has that C/C++
> doesn't: nested procedures.  Whoop!
>
> I am a professional C++ programmer who started with ISO Pascal, and
> have had many similar discussions with your fellow TPers.  I remain
> unconvinced.

Get a life, have fun, check out Delphi, it is way COOL (and mainstream).

Vince
=====

