Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!sq!msb From: msb@sq.UUCP Newsgroups: comp.lang.c Subject: Re: printf and variable length string format (asterisk) Message-ID: <1987Nov29.082912.2800@sq.uucp> Date: Sun, 29-Nov-87 08:29:12 EST Article-I.D.: sq.1987Nov29.082912.2800 Posted: Sun Nov 29 08:29:12 1987 Date-Received: Tue, 1-Dec-87 05:28:09 EST References: <692@zycad.UUCP> <1987Nov27.024339.12253@sq.uucp> <6754@brl-smoke.ARPA> Reply-To: msb@sq.UUCP (Mark Brader) Organization: SoftQuad Inc., Toronto Lines: 20 Checksum: 33494 To my question of why X3J11 did require that a %s-with-precision ("%.2s") only be guaranteed to work with null-terminated strings, Doug Gwyn said: > I think the idea was that X3J11 wanted to allow the implementation > to be able to snarf up the argument with strcpy() etc. I hope that's not all it was. "etc." says it. Use strncpy()! There might also be case for removing the restriction on the grounds of conformance with existing practice, depending on the behavior of the widely used implementations. I'm sure I'm not the only one who's assumed in good faith that the null was not needed. I realize it's quite late, but the more I think about it the more I think that the restriction is unreasonable and should be lifted. What chance? Mark Brader "The last 10% of the performance sought contributes Toronto one-third of the cost and two-thirds of the problems." utzoo!sq!msb, msb@sq.com -- Norm Augustine