LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-22-2010, 07:01 PM   #1
With no.Mute
LQ Newbie
 
Registered: Feb 2009
Posts: 22

Rep: Reputation: 0
Differences of C and Pascal


I was wondering what are the main difference with these two languages? I mean besides just the syntax, only recently started looking at pascal. I find the syntax of Pascal nicer than C. So under the hood so to speak what are the differences? Also why do i see many look down at Pascal? Since C and C++ now are in more use than pascal, im guessing it offers something that Pascal and Object Pascal cant?

-Wn.M
 
Old 02-22-2010, 07:29 PM   #2
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Pascal is a beautiful language indeed. At least it is easier to read than C.

Besides readability, two main differences: C has been more portable than Pascal, because implementations differed less. C has become an ANSI standard well before Pascal was standardized, which also helped portability a lot.

Secondly, there is nothing you can do in assembly but not in C because the language syntax precludes this. C allows much more low-level programming than Pascal, as the Pascal syntax simply doesn't allow some constructs.

C++ is also well standardized, while I am not even sure if an Object Pascal standardization exists.

If you want to write portable programs, or programs a large community is able to maintain, use C. If you just program for fun, no system programming and educational purposes, Pascal has not many drawbacks.

jlinkels
 
Old 02-22-2010, 07:36 PM   #3
Dan04
Member
 
Registered: Jun 2006
Location: Texas
Distribution: Ubuntu
Posts: 207

Rep: Reputation: 37
Pascal, as least historically, lacked some features essential to "serious programming".

http://www.lysator.liu.se/c/bwk-on-pascal.html
 
Old 02-22-2010, 07:38 PM   #4
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
I am a great fan of Pascal, although I have not used it for years. I think that the real difference between the two comes down to what they were originally designed for. Pascal was designed to teach structured programming; the fact that it can be used beyond the classroom is testament to a wonderful language design. The underlying teaching concept of Pascal is why you have to declare all your variables at the start, to give you good design habits, (incidentally this was also a constraint of compiler design at the time to enable the code to be compiled in a single parse).

C mean while was designed to address a real world problem, the writing of an OS without having to use assembly. I like to think of C (and even more so with C++) as being a more relaxed language, it lets you get away with more but so long as you have those good design habits that were instilled by using Pascal you'll not go too far wrong, too often.

Last edited by graemef; 02-22-2010 at 07:39 PM.
 
Old 02-22-2010, 09:32 PM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940
I've written (and sell) a very major software product using Delphi, which is Pascal. (Over 250,000 original lines of Pascal.)

Let the record show that Borland (the producers of Delphi) also simultaneously produced a "C++ Builder" product that shares nearly all of its compiler implementation with Delphi, to the point that you can actually inter-mingle Pascal and C source-code.

Likewise, the venerable gcc compiler suite supports half-a-dozen languages, including both C and Pascal, and once again nearly all of the actual compiler is identical for all of them.

From the computer's point of view, then, "the differences are only skin deep." Both of them are what are called "ALGOL-derivative languages." The practical difference is the one that is perceived by the software designer ... the human being.

Even though the original Pascal language, from Dr. Wirth's Pascal User Manual and Report, was insufficient in several key respects, the various commercial language implementations that followed from it have been very successful. Dr. Wirth conceived of Pascal as a teaching language, and as a very expressive language. It certainly influenced the subsequent evolution of both "C" and "C++" (and vice-versa). It introduced a variety of intrinsic data-types, such as set, and a strongly-typed concept of "enumerated types."

If you do not have a copy of that BYTE Magazine issue with Robert Tinney's "Pascal's Triangle" on the cover ... so sorry, but my pristine copy is not for sale.

(And if you do not have the faintest idea what I am referring to, consider yourself most unfortunate.)

Last edited by sundialsvcs; 02-22-2010 at 09:36 PM.
 
Old 02-22-2010, 10:20 PM   #6
With no.Mute
LQ Newbie
 
Registered: Feb 2009
Posts: 22

Original Poster
Rep: Reputation: 0
Are there any major software developed for Linux written in Pascal? I am kinda guessing not since i see everything in C/C++.
As you said the GCC compiler will basically compile to the same with Pascal or C++, but what are the comparisons to FreePascal and GCC?

Also what was the reason That Mac dropped Pascal as their language of choice? I think everything now is in C++.

BYTE Magazine, huh lol i was eight when the last issue was released. I think i missed that one =P

Last edited by With no.Mute; 02-22-2010 at 10:22 PM.
 
Old 02-23-2010, 12:12 AM   #7
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
... BYTE Magazine issue with Robert Tinney's "Pascal's Triangle" :

http://www.pas.rochester.edu/urpas/files/csSpring08.pdf

http://st-www.cs.illinois.edu/balloon.html
"" One of BYTE's very early issues was dedicated to one of Carl's
(Carl Helmers, founding editor of BYTE) favorite languages, Pascal.
Carl decided he wanted the cover of this issue to be a special one
entitled "Pascal's Triangle," and he wished to illustrate the
superiority of the Pascal language by representing it as a triangular
shaped area of calm in a stormy sea of other computer languages. ""


http://www.google.com/linux → .. pascal applications ..
http://sourceforge.net/apps/trac/wiseslap
http://mac.freshmeat.net/search?Go.x...with=&without=


http://www.google.com/linux → .. written in pascal ..
http://sourceforge.net/projects/alien-force-pas/
http://funknet.net/rfunk/Linux/languages.html
QUOTE : "Generally major projects aren't written in Pascal,
but TeX is the canonical exception.
Pascal is not dead -- Borland's Delphi is Pascal with a GUI
interface."

http://linux.maruhn.com/sec/gpc.html
http://freshmeat.net/tags/pascal?page=4&with=&without=
> > 61 projects tagged "Pascal"
.....
http://i390.photobucket.com/albums/o...-23-064753.jpg

http://i390.photobucket.com/albums/o...screen3265.jpg
.....

Last edited by knudfl; 04-08-2010 at 02:46 PM.
 
Old 02-24-2010, 09:33 PM   #8
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940
One could probably speculate endlessly about languages and language choices.

If you have a particular block of source-code that you need to compile, you should simply evaluate the tools relative to what will compile the code most easily.

It offhand seems to me that, as computers get ever faster and faster, less and less code is written in these languages. More and more code can be written in higher-level systems that are easier to develop in, more portable, etc. simply because it does not matter nearly so much how many resources they use nor how literally-fast they are. The hardware has an embarrassment of riches.

Of course, those "higher-level systems" are written in one of these languages, but that effort becomes somebody else's problem.
 
Old 02-24-2010, 09:48 PM   #9
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
There was a successor to Pascal called Modula-2, but it never seemed to catch on. Pascal used to be the language to learn programming with, and included features such as run time checking of valid input ranges. Pascal compilers originally ran p-code, which made them more portable but they ran slower. Microsoft produced one such compiler, and when Borland came out with a native code compiler, it ran circles around Bill Gate's pride and joy. ( MS retaliated with a head hunter attack against Borland even harassing employees in the parking lot )

Borland later released an object oriented pascal, and then Delphi which was based on their object pascal. C-Builder is a hybrid 'C' Pascal IDE. Delphi (Pascal) code is used for the graphical object library, and C for the main program.

I don't know if these products are still supported. The Linux version of Delphi isn't.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can someone help me with Pascal? randyriver10 Programming 2 09-29-2005 04:09 PM
pascal differences in linux breakerfall Programming 4 11-04-2003 11:56 AM
Pascal code Gerardoj Programming 6 09-28-2003 12:46 PM
Pascal and Knoppix Gerardoj Linux - Software 1 09-27-2003 10:57 PM
Pascal question hfawzy Programming 3 01-10-2003 06:22 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration