Misplaced Pages

Comparison of ALGOL 68 and C++: Difference between revisions

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.
Browse history interactively← Previous editNext edit →Content deleted Content addedVisualWikitext
Revision as of 00:21, 29 March 2008 editCRGreathouse (talk | contribs)Autopatrolled, Administrators12,956 editsm rm nested cat, rm wrong cat← Previous edit Revision as of 14:24, 12 January 2009 edit undoPhresnel (talk | contribs)113 edits "&" is called a reference in C++. Saying "Confusion between &- and pointer-style" is ambigous: "&" can e.g. be one of {address of | ref.-type | bitwise or}Next edit →
Line 21: Line 21:
* forward declarations, * forward declarations,
* textual ] (eg macros), <!-- std ALGOL 68 did have "library prelude option" --> * textual ] (eg macros), <!-- std ALGOL 68 did have "library prelude option" -->
* confusion between &- and pointer-style, * confusion between reference- and pointer-style,
* ] lines (only bracketed comments), * ] lines (only bracketed comments),
* ]. * ].

Revision as of 14:24, 12 January 2009

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:

int max=99;
mode newtype = struct (
   long real a, b, c, short int i, j, k, ref real 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

Category:
Comparison of ALGOL 68 and C++: Difference between revisions Add topic