[comp.sys.ibm.pc.misc] Turbo Pascal vs. C

melling@cs.psu.edu (Michael D Mellinger) (09/20/90)

I have heard that Turbo Pascal has so many extensions in it that you
can do everything in it that you would normally be able to do in C?
Is this true?  If I am going to write for the IBM PC only, is TP a
viable alternative to C(++)?

-Mike

dma@nova.stanford.edu (Domingo A. Mihovilovic) (09/20/90)

Yes!, Turbo Pascal is the best system to develop programs today. It has
all extensions and capabilities you will need ( from the lowest level to
objects ).
It is a very optimized and very fast compiler. I got recently Turbo C++.
Even though it is very fast among the C compilers it is more than 20
times slower than Turbo Pascal. 

	Another good point of TP is that it has an integrated environment with
which you can get work done very quickly (turbo C has also a very good
environment). Some other compilers claim to have integrated environments
but they are useless.
As an example in the PWB (Programmer's Workbench) of Microsoft C 6.0. To do

	- run the PWB and load the program.
	- compile the program.
	- execute the program from the PWB.
	- return to PWB.

takes 3 minutes with the simplest program you can write

#include <stdio.h>

main()
{
printf("hello World!\n") ;
}

What kind of integrated environment is this ?? 

Just to compile the program takes 60 seconds !!!

In Turbo Pascal it takes 2 seconds to compile a more than 1400 line
program ( BGIDEMO.PAS, a graphics demo that comes with the system).

All times were measured in a 386sx machine and DOS 3.3


	
	The only reason to use something different would be portability to some
other platform, but is you are interested only in the IBM PC TPascal 5.5
is the best choice.

Domingo Mihovilovic A.
dma@nova.stanford.edu

bakke@plains.NoDak.edu (Jeffrey P. Bakke) (09/22/90)

In article <1990Sep20.164153.28641@portia.Stanford.EDU> dma@nova.stanford.edu (Domingo A. Mihovilovic) writes:
> Yes!, Turbo Pascal is the best system to develop programs today. It has
> all extensions and capabilities you will need ( from the lowest level to
> objects ).
...ETC ABOUT TP
> 	The only reason to use something different would be portability to some
> other platform, but is you are interested only in the IBM PC TPascal 5.5
> is the best choice.
> 
> Domingo Mihovilovic A.
> dma@nova.stanford.edu
I use Turbo Pascal 5.5 and Turbo C++ 1.0 (actually none of the C++ extensions
yet) and I would recommend Pascal if you're simply looking to start programming
or if you're looking into programs where you're applying generalized 
programming applications.  If your writing a Database program or Inventory
Control, or something along those lines, Pascal is definitely easier to
learn and to debug.  On the other hand if you plan to be writing Hardware
interfaced programs (Hard Drive, High Speed Video, Serial Port Control, etc)
C would probably be a better choice.  Although it is harder to learn and
even harder still to become proficient at (many ways to do 1 thing) C is
also infinitely more flexible and powerful when it comes to low-level 
applications.  If you need your programs to execute faster, C would also
be the better choice.  Good C code, with a good optimizing compiler is
second only to assembly in execution speed (and infinitely easier to code).
C is also more flexible as far as being able to allocate large quantities
of memory and work with multiple memory models.  Pascal is limited to
64K maximum data allocations (unless you spend time with messy alternates)
and it is hard to interface Pascal with other languages.  C is easier
to interface with other Object code.

Anyway, you need to look at what your programming requirements are.  You 
can't simply look at two languages and ask a generalized question about
which is better.  Supposedly, you should be able to write any necessary
code or function in any language you choose but some languages may make it
much harder to implement your requirements.  

Ok, in my opinion C is more flexible and powerful than Pascal, but Pascal
is much more user-friendly and easier to use....
 





-- 
Jeffrey P. Bakke               Internet: bakke@plains.NoDak.edu 
                      UUCP    : ...!uunet!plains!bakke
           BITNET  : bakke@plains.bitnet  

hardin@hpindda.cup.hp.com (John Hardin) (09/22/90)

> Yes!, Turbo Pascal is the best system to develop programs today. It has
> all extensions and capabilities you will need ( from the lowest level to
> objects ).
> It is a very optimized and very fast compiler. I got recently Turbo C++.
> Even though it is very fast among the C compilers it is more than 20
> times slower than Turbo Pascal. 
> 
> Domingo Mihovilovic A.
> dma@nova.stanford.edu
----------

I disagree.  I have used Turbo Pascal since the days of CP/M and 
currently have Turbo Pascal 5.5, Turbo C 2.0, and Turbo C++ 1.0.
I used Pascal for 4 years professionally before learning C and I
would still recommend C or C++ hands down for power.  

While Pascal is better for the novice because of it's simplicity,
verbosity, and strong typing (C++ has strong typing, too, but is
a more complex language) it is a more restrictive language for
the expert.  Pascal was originally developed as a language to
teach structured programming.  It is very good for that, but
not so good for serious large scale programming.

The more extensive library of functions that comes with C and 
the more flexible use of pointers in C than in Pascal make a 
big difference.  I have tried porting programs from one language
to the other for comparison and I always have found myself having
to do a lot of extra work in Pascal because of things it doesn't
do.  Pascal does NOT do everything C does.

I realize some people like Pascal better.  I've met some that
were prejudiced by their professors in school.  Others like
the verbosity (starting with BEGIN/END vs {/}).  Still others
swear by the strong typing, not being interested in the strong
typing of C++ because it's a decendent of K&R C.  To some extent,
language preference is an individual choice.  But from my 
experience, I'd have to say that those who chose Pascal for 
really difficult tasks are working under a handicap.  (Now,
reading someone ELSE's code can be an entirely different matter.
The power of C is also subject to abuse by those with little
interest in writing readable code.)

Now pardon me while I duck before I get shot by a Pascal fan... :-)

John Hardin
hardin@hpindgh.hp.com

poffen@sj.ate.slb.com (Russell Poffenberger) (09/22/90)

In article <1990Sep20.164153.28641@portia.Stanford.EDU> dma@nova.stanford.edu (Domingo A. Mihovilovic) writes:
>Yes!, Turbo Pascal is the best system to develop programs today. It has
>all extensions and capabilities you will need ( from the lowest level to
>objects ).

But pascal was never intended to be a "useful" language. It was developed as
an aid in teaching structured programming. C is much more accepted as an
industry standard for software programming than pascal.

>It is a very optimized and very fast compiler. I got recently Turbo C++.
>Even though it is very fast among the C compilers it is more than 20
>times slower than Turbo Pascal. 
>
>	Another good point of TP is that it has an integrated environment with
>which you can get work done very quickly (turbo C has also a very good
>environment). Some other compilers claim to have integrated environments
>but they are useless.
>As an example in the PWB (Programmer's Workbench) of Microsoft C 6.0. To do
>
>	- run the PWB and load the program.
>	- compile the program.
>	- execute the program from the PWB.
>	- return to PWB.
>
>takes 3 minutes with the simplest program you can write
>
>#include <stdio.h>
>
>main()
>{
>printf("hello World!\n") ;
>}
>
>What kind of integrated environment is this ?? 
>
>Just to compile the program takes 60 seconds !!!

I agree that MSC is quite slow, however it is thorough. Also TC++ will not do
Windows. (Not yet)

>
>In Turbo Pascal it takes 2 seconds to compile a more than 1400 line
>program ( BGIDEMO.PAS, a graphics demo that comes with the system).
>
>All times were measured in a 386sx machine and DOS 3.3
>
>
>	
>	The only reason to use something different would be portability to some
>other platform, but is you are interested only in the IBM PC TPascal 5.5
>is the best choice.

If you want to be more portable, and inline with industry standards, use C. If
you want to ride the wave of the future (Object Oriented Programming) use C++.

Turbo C++ is quite good and is also fully compatible with straight C.


Russ Poffenberger               DOMAIN: poffen@sj.ate.slb.com
Schlumberger Technologies       UUCP:   {uunet,decwrl,amdahl}!sjsca4!poffen
1601 Technology Drive		CIS:	72401,276
San Jose, Ca. 95110             (408)437-5254

dgil@pa.reuter.COM (Dave Gillett) (09/24/90)

In <5953@plains.NoDak.edu> bakke@plains.NoDak.edu (Jeffrey P. Bakke) writes:
>If your writing a Database program or Inventory
>Control, or something along those lines, Pascal is definitely easier to
>learn and to debug.  On the other hand if you plan to be writing Hardware
>interfaced programs (Hard Drive, High Speed Video, Serial Port Control, etc)
>C would probably be a better choice.  Although it is harder to learn and
>even harder still to become proficient at (many ways to do 1 thing) C is
>also infinitely more flexible and powerful when it comes to low-level 
>applications.

Pure myth.  (a) C and Turbo Pascal are of roughly equal power and flexibility,
and anything you can write in C could be written in Turbo Pascal.  (b) Even if
their differences in this regard were significant, they'd still be far from
"infinite".


>  If you need your programs to execute faster, C would also
>be the better choice.  Good C code, with a good optimizing compiler is
>second only to assembly in execution speed (and infinitely easier to code).

Hmmm...  Infinite again.  Most of the things an experienced programmer does in
"good C code" to suggest optimizations to the compiler can also be done in 
Turbo Pascal.  It's true that the best C compilers do more optimization than
the best Pascal compilers, but Forth gives assembly a good run for its money
and so I doubt see is second.


>C is also more flexible as far as being able to allocate large quantities
>of memory and work with multiple memory models.  Pascal is limited to
>64K maximum data allocations (unless you spend time with messy alternates)
>and it is hard to interface Pascal with other languages.  C is easier
>to interface with other Object code.

Well, it's true that TP objects can only be up to 64K, (that's a TP
limitation and not inherent in Pascal as such); it effectively only runs in
"large" model.  This is sufficient for the vast majority of programming tasks;
as with the comment above about "harder to master", multiple memory models
can be as much curse as blessing.  ("messy alternates" indeed)

It's true that Turbo Pascal doesn't have built-in support for function 
pointers.  It also requires you to go to a bit of effort to convince the
compiler that your code will use the interface expected by the code you're
linking too.  In C it's easier to link it, and *much* easier to get it
wrong.


>Anyway, you need to look at what your programming requirements are.  You 
>can't simply look at two languages and ask a generalized question about
>which is better.  Supposedly, you should be able to write any necessary
>code or function in any language you choose but some languages may make it
>much harder to implement your requirements.  

>Ok, in my opinion C is more flexible and powerful than Pascal, but Pascal
>is much more user-friendly and easier to use....

Now that I can agree with.  C wouldn't be my first choice for most things,
but it's an acceptible second choice for almost everything.
                                           Dave

dgil@pa.reuter.COM (Dave Gillett) (09/24/90)

In <1990Sep21.220031.19274@sj.ate.slb.com> poffen@sj.ate.slb.com (Russell Poffenberger) writes:

>But pascal was never intended to be a "useful" language. It was developed as
>an aid in teaching structured programming. C is much more accepted as an
>industry standard for software programming than pascal.

I've recently seen material which suggested that this common story of the
origin of Pascal is not quite accurate.  However, we must also consider that
Turbo Pascal, right from version 1, set out to correct the deficiencies of
Standard Pascal for "real" development, and has continued to do so with each
new version.  In fact, as of version 5.0, Turbo was as close to Modula-2 as
it could get in "software engineering" features while retaining Pascal syntax,
and 5.5 goes on to add object-oriented extensions as well.

It's true that C has become something of an industry standard, much as COBOL
once did.  As far as I can see, that means that anybody who knows C can find
a job, even if they don't use it very well, but only the best can get paid
to use Turbo Pascal.  (I believe it's incredibly easy to write bad C code;
I see it regularly.  Bad Turbo Pascal code seems considerably rarer.)

You should learn C if you want to be sure of finding work.  But I wouldn't
tackle it until you understand how to write it well, and you could cut your
teeth on considerably worse languages than Turbo Pascal.
                                               Dave

bakke@plains.NoDak.edu (Jeffrey P. Bakke) (09/24/90)

In article <410@saxony.pa.reuter.COM> dgil@pa.reuter.COM (Dave Gillett) writes:
> In <5953@plains.NoDak.edu> bakke@plains.NoDak.edu (Jeffrey P. Bakke) writes:
> 
> Pure myth.  (a) C and Turbo Pascal are of roughly equal power and flexibility,
> and anything you can write in C could be written in Turbo Pascal.  (b) Even if
> their differences in this regard were significant, they'd still be far from
> "infinite".
Ok, I guess I was a little frugal with the use of the word infinite (hey 
just learned it and had to use it :-).  Anyway, I will agree that (a) yes,
anything that you write in C can be written in Pascal, but then again, the
same could be said about any two languages.  You could write a inventory
management program in Lisp or ADA but that proves nothing.  You would 
want (I would hope) to choose the language that is the most appropriate
and easiest to code you specific program need.  If I wanted a program to
perform Fast-Fourier Transforms and other Wave functions, I would probably
use Fortran over C or Pascal.  It really depends on what you're doing.
> 
> >  If you need your programs to execute faster, C would also
> >be the better choice.  Good C code, with a good optimizing compiler is
> >second only to assembly in execution speed (and infinitely easier to code).
> 
> Hmmm...  Infinite again.  Most of the things an experienced programmer does in
> "good C code" to suggest optimizations to the compiler can also be done in 
> Turbo Pascal.  It's true that the best C compilers do more optimization than
> the best Pascal compilers, but Forth gives assembly a good run for its money
> and so I doubt see is second.
> 
Ok, sorry about "infinite".  Anyway, most programming language books (at 
least what I've seen) will generally agree that assuming you have nothing
special in a compiler, C code usually (with good coding) can create faster
code than Pascal.  Simply because C is closer to the assembly level than
pascal and many different code changes can produce the same end results.  Of 
course, many times this is really besides the point.  I find that if your
program is too slow, look at the algorithm, not the code.  But there are
times (comm port IO, Direct graphics) where C code can be written to 
execute faster than Pascal.  Again, this can be somewhat subjective and
can be influenced by the compiler optimizations.  

Anyway, this is simply my opinion based on what I've learned.  I don't want
to go to war over which is better.  There are very few languages that I
hold in contempt, Pascal and C aren't in that list.  I use both and enjoy
both.  


Jeffrey P. Bakke               Internet: bakke@plains.NoDak.edu 
                      UUCP    : ...!uunet!plains!bakke
           BITNET  : bakke@plains.bitnet  
-- 
Jeffrey P. Bakke               Internet: bakke@plains.NoDak.edu 
                      UUCP    : ...!uunet!plains!bakke
           BITNET  : bakke@plains.bitnet  

decomyn@penguin.uss.tek.com (09/26/90)

In article <410@saxony.pa.reuter.COM> dgil@pa.reuter.COM (Dave Gillett) writes:
>It's true that Turbo Pascal doesn't have built-in support for function 
>pointers. 

This is not true, at least not in Turbo V5.5.  I am currently writing a program
that allows data to be sorted in different orders for viewing on the screen.
Rather than use a CASE statement whenever new data is read in, I have assigned
a PROCEDURE (or FUNCTION -- I am away from the code right now, and can't
remember for sure) variable, and whenever the sorting method changes, I just
change the address in the variable to point to the new routine.  No fuss, no
muss. :-)

Brendt Hess
decomyn@penguin.uss.tek.com

er1m+@andrew.cmu.edu (Ethan J. Rasiel) (09/26/90)

i have seen the beta version of Turbo Pascal 6.0 and it's cool!

hardin@hpindda.cup.hp.com (John Hardin) (09/27/90)

dgil@pa.reuter.COM (Dave Gillett) writes:

> It's true that C has become something of an industry standard, much as COBOL
> once did.  As far as I can see, that means that anybody who knows C can find
> a job, even if they don't use it very well, but only the best can get paid
> to use Turbo Pascal.  (I believe it's incredibly easy to write bad C code;
> I see it regularly.  Bad Turbo Pascal code seems considerably rarer.)

Oh, come on now!  Pascal vs C discussions always degenerate into name
calling pretty fast, kind of like discussions about the best editor 
(Brief :-) ), but this discussion is going down hill more repidly than
most.

John "C programmers have better oral hygiene" Hardin
---------

dgil@pa.reuter.COM (Dave Gillett) (09/27/90)

In <6616@tekgen.BV.TEK.COM> decomyn@penguin.uss.tek.com writes:

>In article <410@saxony.pa.reuter.COM> dgil@pa.reuter.COM (Dave Gillett) writes:
>>It's true that Turbo Pascal doesn't have built-in support for function 
>>pointers. 

>This is not true, at least not in Turbo V5.5.

By golly, it's not true in 5.0, either.  I just couldn't find it because it
wasn't indexed the way I'd describe it.  Never mind.
                                          Dave

phys169@canterbury.ac.nz (09/27/90)

In article <1990Sep21.220031.19274@sj.ate.slb.com>, poffen@sj.ate.slb.com (Russell Poffenberger) writes:
> But pascal was never intended to be a "useful" language. It was developed as
> an aid in teaching structured programming. C is much more accepted as an
> industry standard for software programming than pascal.
> 
Turbo Pascal is definately a "useful" language, whatever the original Pascal
was designed to be. There are, as everyone points out, pros and cons with both;
Pascal's greatest advantage is that it is understandable, to the point that, if
a program has no syntax errors then it has a *much* lower chance of logical
errors than a C program - therefore it is best for beginners, prototyping, and
high-reliability software. It is too easy in C to write a program that the
compiler accepts, but contains a punctuation or pointer error which makes the
execution go wrong. My favoutrite policy is to write major programs first in
Turbo Pascal, let them go through several patches, then rewrite the program in
C. This sounds like a lot of work, but it is good policy for programs to
undergo a major re-write after the simplicity of the original has been spoilt
but a history of hurried patches.

Mark Aitchison, Physics, University of Canterbury, New Zealand.

noren@dinl.uucp (Charles Noren) (09/28/90)

Its time for a completely unbiased informed observation:

C++ is the language of choice of REAL programmers.  Thats why
it is growing so rapidly in industry.  If you're a REAL programmer
you'll program in C++, even though its harder to learn than Pascal.
Pascal is for quiche eaters.  Remember, if it can't be done in C++,
it isn't worth doing!

...just kidding :-) :-) :-) :-) !!

-- 
Chuck Noren
NET:     dinl!noren@ncar.ucar.edu
US-MAIL: Martin Marietta I&CS, MS XL8058, P.O. Box 1260,
         Denver, CO 80201-1260
Phone:   (303) 971-7930

rhys@batserver.cs.uq.oz.au (Rhys Weatherley) (09/28/90)

noren@dinl.uucp (Charles Noren) writes:

>Its time for a completely unbiased informed observation:

>C++ is the language of choice of REAL programmers.  Thats why
>it is growing so rapidly in industry.  If you're a REAL programmer
>you'll program in C++, even though its harder to learn than Pascal.
>Pascal is for quiche eaters.  Remember, if it can't be done in C++,
>it isn't worth doing!

>...just kidding :-) :-) :-) :-) !!

I'll no doubt get flamed for this, but I couldn't resist :-).

On my wall I have a poster that enumerates exactly what real programmers
are and aren't (yes, one of those lists :-).  Among its many words of
wisdom is the following:

	"Real programmers don't write in PASCAL, BLISS or ADA, or
	 any of those pinky computer science languages.  Strong typing
	 is for people with weak memories."

I'll type and and post the full list if there are a substantial number
of requests.

Bye!

Rhys.

+===============================+==============================+
||  Rhys Weatherley             |  University of Queensland,  ||
||  rhys@batserver.cs.uq.oz.au  |  Australia.  G'day!!        ||
+===============================+==============================+

harry@aeshq.UUCP (Harry Pulley) (10/03/90)

     I learned Pascal well before I learned C.  I wrote a fractal program in 
Turbo Pascal which I later converted to Turbo C as an exercise in that area.
I used exactly the same algorithm, the same number of iterations, the same
accuracy, etc.  I compiled the Pascal version normally, and the C version was
optimized for speed.  

     The result: the C version was more than 30% faster than the Pascal.  I was
running a 286 with a numerical co-processor.  The Pascal version required 33
minuted to finish a VGA screen, while the C version only took 22 minutes.
(Please note that these values are approximate; I don't have my test records
with me...)

     I am currently working on support routines for a database on a UNIX 
system.  To 'talk' to SQL and the database, almost all function parameters and
return values must be referenced using pointers.  I feel this application 
would be much more challenging to write in Pascal than it was in C, if not
impossible.

     Pascal is excellent for many applications, especially those where an error
overlooked by the compiler may cause damage to memory, disks, etc.  C compilers
will let you compile code which is obviously wrong (too many or wrong           parameters, etc.), without a peep.  This has created many a horrible            programming experience over the years.  

     C assumes that you know what you are doing.  I have, on occasion, done 
some things which would be considered bad programming practice.  For example, I
have provided floats for a function expecting integers.  The program worked 
alright; for that system, etc.  I didn't need to do convertions before I passed
the values on to the next procedure.  This, in my opinion, is a definite 
advantage of C over Pascal.  But you gotta know what yer doin'...

     C is currently my preferred programming language.  I am, however, glad 
that I used Pascal prior to learing C.  Except for a few Zen programming 
techniques (similar to the one above) I like to think that my programming style
still shows some of the structure that was necessary while I was writing 
programs in Pascal.

HCPIV

{ No flames intended toward Pascal users, :-) ! }