How to predict size of outcome of vsprintf?

Henry Spencer henry at utzoo.uucp
Mon Mar 20 14:46:25 AEST 1989


In article <1618 at thor.acc.stolaf.edu> mike at stolaf.edu writes:
>	int snprintf(char *str, size_t len, const char *fmt, ...);
>	int vsnprintf(char *str, size_t len, const char *fmt, va_list ap);
>
>that do bounds checking on their output.  Richard Stallman suggested to
>ANSI that they include such routines in the C standard; I am of the
>impression that various other people independently made the same or a
>similar suggestion...

This is correct.

>I do not understand why the pANS does not address this problem in some way.

Two reasons:

1. Lack of prior experience with it.  Believe it or not, standards
	committees are supposed to be consolidating existing, proven
	practices, not endorsing new and untested ideas.  X3J11, while
	not perfect, has done much better in this area than a lot of
	other language committees.  This is a feature, not a bug!

2. The fact that most of the proposals came very late in the standardization
	process, when quite strong majorities were required to add new stuff.
	I have been told that at least one attempt to add snprintf and
	friends failed by one or two votes.
-- 
Welcome to Mars!  Your         |     Henry Spencer at U of Toronto Zoology
passport and visa, comrade?    | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list