[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
snmpconf random thoughts on policy language implementation
My general understanding of the policy language is that
(1) variables are converted on demand to the proper type,
and (2) function calls are always call by reference.
Then in implementing sprintf, %d in the format string
should should cause the corresponding argument to be
converted to integer (likewise for %s etc.). But here,
we want to operate on copies of the format string
arguments, not the originals, right? Otherwise, sprintf
could change the values of arguments to the format string.
So, we want sprintf to be call by reference with regard to the
destination string, but call by value elsewhere, right?
In implementing sprintf is there any need for the
%p format specifier for printing a pointer? Should it
be left in for the sake of completeness in case it's
needed someday? Also, it's always bothered me that C
doesn't bother to make sure that the number of format
specifiers in the format string matches the number of
arguments to the format string e.g.
sprintf(c,"%s %s %s", a, b); where there are
three format specifiers but only two arguments to the
format string is perfectly acceptable
in C. Wouldn't this language be better if we
required that number of format specifiers equal the number
of arguments to the format string?
The language specification says that comments begin with
/* and end with */ or begin with // and go to the end
of the line. The question is, do we allow nested
I'm blocking out this section of code
/* my original comment header for this block */
Some C/C++ compilers allow this, some don't. It makes it
much easier on the programmer if we do allow it, and it's
fairly easy to implement in the lexer.