Misplaced Pages

Comparison of ALGOL 68 and C++

Article snapshot taken from[REDACTED] with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

This is an old revision of this page, as edited by 208.138.31.76 (talk) at 21:00, 12 February 2008 (Mode declaration). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Revision as of 21:00, 12 February 2008 by 208.138.31.76 (talk) (Mode declaration)(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
Comparison of
programming languages

Comparison of individual
languages

The nearest living sibling to ALGOL 68 may be C++, making this a good comparison candidate:

C++ doesn't have:

  • PROC - nested functions,
  • OP and PRIO - definable operator symbols and priorities,
  • garbage collection,
  • use before define,
  • formatted transput using complex formatting declarations,
  • := - assignment operation symbol (to avoid confusion with equal sign),
  • array (and slice operations on them, but in layered libraries),
  • automatic UNIONs,
  • CASE expressions,
  • nonlocal GOTO
  • intuitive declaration syntax due to its origin from C.

ALGOL 68 doesn't have:

Code Example

Mode declaration

A new mode (type) may be declared using a mode declaration:

<u>int</u> max=99;
<u>mode</u> <u>newtype</u> = <u>struct</u> (
    <u>long</u> <u>real</u> a, b, c, <u>short</u> <u>int</u> i, j, k, <u>ref</u> <u>real</u> r
);

This has the similar effect as the following C++ code:

const int max=99;
typedef class 
{ 
    double a, b, c; short i, j, k; float &r;
} newtype;

Note that for ALGOL 68 only the newtype name appears to the left of the equality, and most notably the construction is made - and can be read - from left to right without regard to priorities.

External references

Categories:
Comparison of ALGOL 68 and C++ Add topic