Jump to content

Comparison of programming languages (array)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Dreftymac (talk | contribs) at 17:20, 27 October 2007 (edit). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Array system cross-reference list

Programming language Base index Bound Check Multidimensional Dynamically-sized
Ada n checked yes init1
APL7 0 or 1 checked yes init1
assembly language 0 unchecked no no
BASIC 1 checked no init1
C 0 unchecked yes2 heap3,4
C++5 0 unchecked yes2 heap3
C# 0 checked yes2 heap3,9
Common Lisp 0 checked yes yes
D 0 varies11 yes yes
FreeBASIC n checked yes yes
Fortran n varies12 yes init1,heap3
FoxPro 1 checked yes yes
IDL 0 checked yes yes
Java5 0 checked yes2 heap3
Lua 1 checked no2 yes
MATLAB 1 checked yes8 yes
Oberon-1 0 checked yes no
Oberon-2 0 checked yes yes
Pascal n varies13 yes varies10
Perl n checked no2 yes
PL/I n checked
Python 0 checked no2 yes
Ruby 0 checked no2 yes
Haskell any checked yes yes
Scheme 0 checked no2 no
Smalltalk5 1 checked no2 yes6
Visual BASIC n checked yes yes
Windows PowerShell 0 checked yes2 heap
  1. Size can be chosen on initialization/declaration after which it is fixed.
  2. Allows arrays of arrays which can be used to emulate multi-dimensional arrays.
  3. Size can only be chosen when memory is allocated on the heap.
  4. C99 allows for variable size arrays – however there is almost no compiler available to support this new feature.
  5. This list is strictly comparing language features. In every language (even assembler) it is possible to provide improved array handling via add on libraries. This language has improved array handling as part of its standard library.
  6. The class Array is fixed-size, but OrderedCollection is dynamic.
  7. The indexing base can be 0 or 1, but is set for a whole "workspace".
  8. At least 2 dimensions (scalar numbers are 1×1 arrays, vectors are 1×n or n×1 arrays).
  9. Allows creation of fixed-size arrays in "unsafe" code, allowing for enhanced interoperability with other languages
  10. Varies by implementation. Newer implementations (FreePascal and Delphi) permit heap-based dynamic arrays.
  11. Behaviour can be tuned using compiler switches. As in DMD 1.0 bounds are checked in debug mode and unchecked in release mode for efficiency reasons.
  12. Almost all Fortran implementations offer bounds checking options via compiler switches. However by default, bounds checking is usually turned off for efficiency reasons.
  13. Many implementations (Turbo Pascal, Delphi, FreePascal) allow the behaviour to be changed by compiler switches and in-line directives.