Lawrie Schonfelder wrote:
> <SNIP>
> An extremely good question! The argument was something like this.
> Initialisation is done at compile time. Some vendors are loath to have
> the intrinsic library available at compile time, at least the floating
> point part of it. Therefore, we must ban floating point intrinsics
> from initialisation expressions. A very weak argument I thought at
> the time, and I think it is even worse now. Another slightly stronger
> argument used was that compilers could be cross compilers, running
> on one machine but generating code for a different machine where
> the FP arithmetic was different. In such cases the initialisation on
> the compiler machine could produce different values than
> would apply on the target machine.
Frankly speaking, both those arguments are easily made irrelevant.
Any run time overhead caused by initialization of static (esp.
constant) data has to be considered trivial when compared with
the task that the program performs. Therefore I wouldn't mind
if the actual implementation of such initializations by
a processor would just generate run time code to calculate
the constants before it runs the program (or performs similar
initialization calls for other modules that may use the module
in question).
And some initializations (possibly a majority in any program)
would still evaluate easily enough for the compiler to calculate
immediately.
The advantages (which, I believe, greatly outweight the arguments
against library function use in initializations) follow:
1) I'd be able to declare my constants as constants (i.e.,
PARAMETERS) and the compiler would be able (and obliged) to check
if they are not modified anywhere,
2) I wouldn't have to worry about
a) manual initialization of the pseudo-constants at program start,
b) verification in library using the 'constants' routines whether
or not they were indeed initialized.
> Your example illustrates precisely why I have been conducting
> an as yet unsuccessful campain to have these petty unnecessary
> restrictions removed.
I discover between one and three such restriction every week :(
I guess I'll have to live with them for the foreseeable future
as F2000 proposals have already been pronounced final (so I heard).
In any case, I wish your campaign a lot of success.
Regards,
Artur Swietanowski
----------------------------------------------------------------------
Artur Swietanowski mailto:[log in to unmask]
Institut fuer Statistik, Operations Research und Computerverfahren,
Universitaet Wien, Universitaetsstr. 5, A-1010 Wien, Austria
tel. +43 (1) 407 63 55 - 120 fax +43 (1) 406 41 59
----------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|