[std-interval] Mathematical relations and default initialization
lawrence.crowl at gmail.com
Mon Sep 25 18:58:32 PDT 2006
On the matter of default constructors.
>>1- no default constructor at all
A private default construction essentially prohibits declaring a
variable without giving it an explicit initial value. This approach
would certainly avoid the debate about the debate about the 'right'
initial value. Unfortunately, if falls afoul of generic template
algorithms and array initialization.
This would be the second fastest solution, and permits use of
the fastest initialized global memory. (Modern systems have fast
mechanisms to obtain a zero-initialized page in virtual memory,
and variables that need zero initialization are allocated to
This approach also has the virtue of matching the language's current
concept of zero initialization.
These are equally fast, typically a bit slower than 2 for local
data and more so for non-local data. The reason 3 and 4 are slower
for non-local data is that the initial values are stored on disk
with the executable file, and must be copied from disk to memory.
>>5- uninitialized tag
This approach introduces yet another decision in the implementation
of basic operators, which induces a non-trivial overhead. On modern
processors, decisions and memory accesses are the dominant costs.
>>6- see below (something a la "singular iterator")
I didn't see a description of this approach, but it seems to like
builtin types, i.e. completely uninitialized memory, thus yielding
an undefined state for the variable. This is the fastest solution.
I would not characterize this as a "Not an Interval" solution.
The latter is more like 5.
My recommendation is first 6 and second 2, but then I don't
write interval programs -- I implement compilers.
More information about the Std-interval