Comparison of Pascal and Delphi

Comparison of Pascal and Delphi
Programming language comparisons
General comparison
Basic syntax
Basic instructions
Arrays
Associative arrays
String operations
String functions
List comprehension
Object-oriented programming
Object-oriented constructors
Database access
Database RDBMS

Evaluation strategy
List of "hello world" programs

ALGOL 58's influence on ALGOL 60
ALGOL 60: Comparisons with other languages
Comparison of ALGOL 68 and C++
ALGOL 68: Comparisons with other languages
Compatibility of C and C++
Comparison of Pascal and Borland Delphi
Comparison of Object Pascal and C
Comparison of Pascal and C
Comparison of Java and C++
Comparison of C# and Java
Comparison of C# and Visual Basic .NET
This box: view · talk · edit

This article is a comparison between Pascal and Delphi because Borland, the original manufacturer of Delphi, once used Delphi for their version of the Pascal-based programming language used in the product, which is otherwise known as Object Pascal. Compatibles still maintain the Object Pascal designation because Delphi is a registered trademark.

Pascal is a programming language, developed in 1970 by Niklaus Wirth. The original Pascal employed a bootstrapping construct where each successively more complicated compiler compiled the next iteration. Thus the compiler P2 was written in the dialect compilable by P1, and could in turn compile P3, and such on all the way till P5 which implemented "full" Pascal and was more optimized.

Borland Corporation, like the wildly popular UCSD Pascal before them, took the P4 subset compiler as their basis for their Turbo Pascal range, probably because they considered it more efficient on the micros they were targeting. Over time their dialect implemented many UCSD extensions to the original Pascal like the "string" type. Their language went through several versions and names, such as Turbo Pascal, Borland Pascal, and finally Delphi Pascal. This page briefly goes over the differences between those dialects of the language. It does not go into the extensions provided by Delphi, that is the subject of a Delphi page. Rather it just covers the differences that exist between the base implementations.

Contents

Terminology

It is correct to refer to "Pascal" in general as Niklaus Wirth's original language (and derivatives) and Borland's dialect as "Delphi". When referring to Borland's previous dialects, the terms "Turbo Pascal", and "Borland Pascal" apply.

The term "ISO 7185" or "ISO 7185 Pascal" is used here as synonymous with Niklaus Wirth's programming language Pascal. The ISO 7185 standard is the standardized version of Niklaus Wirth's language, as he has stated several times.

Differences between the languages

Because Borland Delphi is a widely used version of Pascal, it is useful to compare the two languages. Note that here are presented only the differences between Borland Delphi and the basic ISO 7185 standard. Undiscussed are any extensions provided by Borland Delphi. In other words, this section answers the question "why doesn't my standard Pascal program run under Borland Delphi?", and perhaps "what can I write in Borland Delphi that will also be compatible with the ISO 7185 standard?".

1. Procedures and functions may not appear as parameters (it is true that it can be done, but a non-standard syntax must be used).

2. Goto statements cannot reference targets outside procedure/function bodies (so called "intraprocedural gotos").

3. No file buffer variable handling. Standard Pascal has file "buffer variables", and "get" and "put" procedures to operate on them. This functionality is not present in Borland Delphi.

4. No "sized" dynamic variable allocation. Given a variant record, the size of a particular variant cannot be specified as per the standard. I.e., the following statement is invalid:

new(p, t)

Where t is a variant record tag type.

5. The functions "pack" and "unpack" are not implemented.

6. { and (*, } and *) are not synonyms of each other as required by the standard. I.e.:

{ comment *)

is not valid in Borland Delphi (Delphi uses the scheme of allowing the different comment types to indicate nested comments). It is valid in Turbo Pascal though.

7. Does not replace eoln with space as the standard requires. When reading through the end of a line, the eoln character is supposed to be replaced with a space in ISO 7185. Instead, reading through eoln in Borland Delphi gives the character code for carriage return (13), followed by line feed (10).

8. Numbers and booleans are not printed out in their "default" field widths, but are printed in the minimum amount of space. For example:

write(5);
write(55);

is equivalent to:

write(5:1);
write(55:2);

in Delphi, but:

write(5:TotalWidth);
write(55:TotalWidth);

in ISO 7185, where TotalWidth is implementation-defined.

For booleans:

write(false);
write(true);

is equivalent to:

write('false':5);
write('true':4);

in Delphi, but:

write('false':TotalWidth);
write('true':TotalWidth);

in ISO 7185, where TotalWidth is implementation-defined.

9. Temporary files are not supported. Executing reset() or rewrite() results in an error under Delphi. Under standard Pascal it opens a temporary file that exists only for the run of the program.

See also

Further reading

External links

  • The standard, ISO 7185 Pascal web site [4]



Wikimedia Foundation. 2010.

Игры ⚽ Нужно решить контрольную?

Look at other dictionaries:

  • Comparison of Pascal and C — Programming language comparisons General comparison Basic syntax Basic instructions Arrays Associative arrays String operations …   Wikipedia

  • Comparison of Pascal and Borland Delphi — This article is a comparison between Pascal and Borland Delphi because Borland uses the name Delphi exclusively for their version of the computer language.Pascal is a programming language, developed in 1970 by Niklaus Wirth. An alternative… …   Wikipedia

  • Comparison of Object Pascal and C — Programming language comparisons General comparison Basic syntax Basic instructions Arrays Associative arrays String operations …   Wikipedia

  • Comparison of Java and C++ — Programming language comparisons General comparison Basic syntax Basic instructions Arrays Associative arrays String operations …   Wikipedia

  • Comparison of Java and C Sharp — This is a comparison of the C# programming language with the Java programming language. As the two are both garbage collected runtime compiled languages with syntax derived from C and C++, there are many similarities between Java and C#. However …   Wikipedia

  • Pascal (programming language) — Pascal Paradigm(s) imperative, structured Appeared in 1970 Designed by Niklaus Wirth Typing discipline static, strong, safe …   Wikipedia

  • Delphi Prism — Embarcadero Delphi Prism Developer(s) RemObjects Software Initial release 2008 Operating system Microsoft Windows Available in English, French, German, Japanese …   Wikipedia

  • Comparison of OpenGL and Direct3D — Direct3D and OpenGL are competing application programming interfaces (APIs) which can be used in applications to render 2D and 3D computer graphics, taking advantage of hardware acceleration when available. Modern graphics processing unit (GPUs)… …   Wikipedia

  • Comparison of programming languages (string functions) — String functions redirects here. For string functions in formal language theory, see String operations. Programming language comparisons General comparison Basic syntax Basic instructions Arrays …   Wikipedia

  • Comparison of programming languages — Programming language comparisons General comparison Basic syntax Basic instructions Arrays Associative arrays String operations …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”