ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
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.
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.
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.
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.
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. ""
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.