Harbour Data Types and limits
The links you provided refers to CA-Clipper. So far I could not find any info for HB on what’s the biggest and smallest (precision) value a numeric type can hold, etc.
It was many times discussed on Harbour related forums.
In case of numeric values it’s the same as in Clipper and most of other languages – on platforms you are using it’s limited by IEEE758 double value specification.
The date ranges and internal representation is the same as in Clipper too. In conversions between strings and date values Harbour supports years in range 0-9999 but Clipper 1-2999.
Harbour has four data types unsupported by Clipper:
- HASH ARRAYS
HASH ARRAYS are arrays which can be indexed by user defined values of different types (numbers, dates, timestamps, strings, pointers) For more information read “HASH ARRAYS” in doc/xhb-diff.txt.
TIMESTAMPS are datetime values which contain date and time in milliseconds (see “DATETIME/TIMESTAMP VALUES” in doc/xhb-diff.txt)
SYMBOLS are references to functions (procedures) or methods. (see SYMBOL ITEMS AND FUNCTION REFERENCES in doc/xhb-diff.txt)
POINTER items are defined by some subsystems and 3-rd party code at C level and usually they refers to some low level resources or memory addresses. In short words it’s type of handle returned to PRG level. Unlike numeric handles pointer item value is protected and cannot be changed by PRG code so they are much safer. In C code using pointer items it’s possible to verify if given pointer item was defined by the same subsystem and protect against wrong pointers. Finally C code author can bound with pointer item destructor which is executed automatically when variable is out of scope and can release resources allocated for given item.
Maximum size of strings and arrays is limited only by available memory (I will use “unlimited” in such case).
Maximum number of symbols in single module (compiled PRG file) is 65536. Maximum number of symbols registered in HVM from all modules and RDD subsystems is 65536. The maximum number of symbols reduces number of different names which can be used for function/procedure/alias/field/public/private/class/method names. All such names are registered in HVM in single global symbol table. Anyhow the maximum size of global symbol table does not mean that it sets limit for maximum number of given constructions. Some of them like private variables can share the same name.
There is no limit for number of memvars (public and private variables) and fields but please remember about maximum size of global symbol table and number of symbols in single module. Maximum number of workareas is 65534. Maximum number of local variables in a single function is 32767. Maximum number of local parameters in a single function is 32767. Maximum number of static variables in single module is 65535 (in whole application is unlimited).
The maximum size of literal string defined in PRG code is 16MB. The maximum size of literal array defined in PRG code is 65535.
The size of PCODE generated for single function is unlimited. Anyhow maximum size of conditional and unconditional jump in Harbour is 8388607. It may introduce limits in some construction so we can only define minimum fully supported size of PCODE generated for single function or code block as 8MB. Longer code can be generated if it does not exploit jump size limit. Macro compiler has exactly the same limits as compiler. For more info look at section “MACRO COMPILER” in doc/xhb-diff.txt.
Things like maximum number of open files, maximum file size, etc. are limited only by operating system and used data structures. Harbour does not introduce any new limits here. You may find my messages about limits defined by DBF* structures or read about them in doc/xhb-diff.txt, section “NATIVE RDDs”