They were disabled by default since Delphi 2, IIRC was released. The actual parameter was provided in a dialog box with Delphi 1, and I seem to recall the default noise, which was changed from enabled to disabled in the next version. It was a long time, so I could be disconnected alone when the default was overridden; it could be D3. Assigned constants are a carryover from the old days of Turbo Pascal and replace the absence of the actual type of the static variable. They have been replaced by a better solution, which are initialized (global) variables (see Declaring Variables ).
If you really need to use a writable constant, you should only do this in the smallest (most restricted) area where you need it, instead of changing the global settings. Constants should be exactly where possible (constant). A typical reason for using constants for writing is when you need a local variable in a certain area (for example, a procedure, function or unit) that needs to maintain its value between calls, and this is usually the best way to do this. Some of the parameters are object fields (member variables) or variables with a limited scope (variables that are visible in limited areas, for example, in the implementation section of a block, are initialized with the initial value).
Assignable constants mean that the value can be changed at run time and is really rarely useful. True constants are that which is constant and should not be allowed to change.
The same can be said for typed constants; there must be an urgent need to use them, and it rarely happens if you do not store a constant array, record, pointer, or procedural type, as in these declarations:
const TIntLookupArray: array[0..1] of Integer = (1, 2); TErrorMsgs: array[0..1] of string = ('Invalid input', 'Invalid sequence');
Is there a reason you use typed constants? You will not have this problem if you just use
const clicks = 1;
and let the compiler decide the correct type. If you want to make sure this is an Integer size, just use a type like
const clicks = Integer(1);
See the Delphi documentation for more information.
Ken white
source share