| Allegro CL version 10.0 This page is new in 10.0. |
This compiler switch can direct the compiler to examine format statemnts being compiled to check whether the number of arguments supplied in the format statement corresponds to the number called for in the format control string.
Format statements may have the exact number of arguments called for:
(format t "~d days left for a ~d percent discount~%" 10 20)
Too few arguments:
(format t "~d days left for a ~d percent discount~%" 10 )
Or too many arguments:
(format t "~d days left for a ~d percent discount~%" 10 20 30 40)
Having exactly the number of arguments called for is normal practice. It is not an error (indeed it is explicilty permitted) to have more than are called for. Having too few is not in itself an error but if the form is ever evaluated, an error will be signaled.
This compiler switch variable differs from other in that its value can
be one of the integers 0, 1, 2, 3, and 4, as well
as nil
(equivalent to 0)
and t
(equivalent to 2). Actually, any
non-nil
value other than 0, 1, 2, 3, and 4
is equivalent to t
(which, again, is
equivalent to 2).
When the value of this switch is 1, 2 (or t
),
3, or 4, then when a format form is compiled, information is
collected on whether the number of arguments supplied is less than,
equal to, or more than the number called for in the format string. If
the format string is too complex to analyse (perhaps because it will
not be known until run time whether or not there are enough
arguments), that information is also collected. Finally, if certain
errors in the format form are detected, that information is collected.
Like other switches, this one can be set or bound to one of the legal
values, or set or bound to a function object that accepts five
arguments and returns t
or nil
or 0, 1, 2, 3, or 4. The arguments
passed to the function will be the values of the safety, space, speed,
debug, and compilation-speed optimization qualities, in that order.
Here is the behavior for the various values of the switch:
nil
: Collect no statistics, signal no
warning or compiler notes.
t
, 1, 2, 3, or 4: Collect statistics about
format argument counts compared to what is called for in format
strings; about format strings too complex to analyze; and about
syntactic errors in format forms.
t
or 2: Gather statistics, signal
style-warning if not enough arguments.
Statistics are only kept if the value of the
variable *format-arg-count-stats*
is a list of six
fixnums (representing all, missing args, args equal in number to
needed, args more than needed, too complex, and syntax error). These
numbers are incremented appropriately as format forms are
analysed. Warnings and compiler-notes are printed if the switch value
calls for them. The function format-arg-count-stats prints the
collected statistics.
This switch is initially bound to a function which returns 1 for safety 0 and compilation-speed 0 or 1; returns 2 for safety 1, 2 or 3 and compilation-speed 0 or 1; and returns 0 for compilation speed 2 or 3. The initial values of safety and compilation-speed are both 1, so initially this switch returns 2.
See Checking format forms during compilation in miscellaneous.htm for more information.
Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page is new in the 10.0 release.
Created 2019.8.20.
| Allegro CL version 10.0 This page is new in 10.0. |