From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu Subject: Re: [9fans] snprint(), getfields() specification From: "rob pike" MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Message-Id: <20010510145944.45DA619A01@mail.cse.psu.edu> Date: Thu, 10 May 2001 10:59:41 -0400 Topicbox-Message-UUID: 9da522c8-eac9-11e9-9e20-41e7f4b1d025 Observe the error: > some of the printed characters were discarded. None of the printed characters was discarded. I understood what was being said and I am objecting to the design. I understand the idea - that you can't find out what you need any other way, so return that information and use strlen() to find out what really got done - but I still think it sets a dangerous precedent. Like the strcpy() that returned a pointer to the end of the string (fixed by ANSI C), the return value sacrifices a long-standing principle to short-sighted expedience. C99 has made many mistakes, and this is hardly the worst, but it bothers me that people are now (or will soon be) arguing that we should follow a broken design (c.f. malloc(0)) because it's written down somewhere. I suppose we should fix (read break) our snprintf() implementation, but I can at least hold on to the fact that snprint() is not defined by C99. I really object to this speculative return value, but it's not my decision so pooey. It's malloc(0) and int a[0] all over again. Sigh. -rob