Hi Pascal,
I *know* that
(including the no-way part).
And I *know* too that this misuse is sometimes what's expected
by developers...
Anyway, I don't think it's desirable that kinds of pointers
are checked.
Still my humble opinion.
Le 21/06/2019 à 16:47, Pascal Cuoq a
écrit :
Hello,IMHO, considering that flexibility is what I
love in C programming, and that this checking should be
printf job (in that case),
Unfortunately, this is not how printf, or other variadic
functions, work. The way they work is: the non-variadic
arguments (in the case of printf, the format string) indicate
what variadic arguments should be consumed with what type. If
the types of the arguments actually passed do not match the
types indicated by the non-variadic arguments, the behavior is
undefined.
Not only printf, and other variadic functions, have no
obligation to warn you if you misuse them, but on every existing
platform (including the exotic platforms where a pointer is not
a pointer), they actually have no way to warn you that you are
misusing them.
|