Revision as of 14:24, 12 January 2009 editPhresnel (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}← Previous edit | Revision as of 14:30, 12 January 2009 edit undoPhresnel (talk | contribs)113 edits nested functions *can* be defined, but through local class type definitionsNext edit → | ||
Line 3: | Line 3: | ||
C++ doesn't have: | C++ doesn't have: | ||
* ] - nested functions, | * ] - first class nested functions (emulation due to local definitions of class-types, which then could be ) , | ||
* ] - definable operator symbols and priorities, | * ] - definable operator symbols and priorities, | ||
* garbage collection, | * garbage collection, |
Revision as of 14:30, 12 January 2009
The nearest living sibling to ALGOL 68 may be C++, making this a good comparison candidate:
C++ doesn't have:
- PROC - first class nested functions (emulation due to local definitions of class-types, which then could be functors) ,
- 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:
- public/private access protection,
- overloaded procedures (in contrast to operators),
- explicit memory deallocation,
- forward declarations,
- textual preprocessing (eg macros),
- confusion between reference- and pointer-style,
- comment lines (only bracketed comments),
- hierarchical classes.
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
- A comparison of PASCAL and ALGOL 68 - Andrew S. Tanenbaum - June 1977.
- Orthogonal language design - Apr 2004 - retrieved May 10, 2007
- How Solve the Dangling Else? - Apr 2004 - retrieved May 10, 2007
- A comparison of Pascal, C, C++ and Algol68: Types, cont Type system, Type checking, Type safety, Type conversion, Primitive types, Aggregate types: arrays - Apr 2004 - retrieved May 10, 2007
- Arrays in Algol68 - Apr 2004 - retrieved May 10, 2007