From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <200105101425.KAA28328@egyptian-gods.MIT.EDU> To: 9fans@cse.psu.edu Subject: Re: [9fans] snprint(), getfields() specification In-Reply-To: Your message of "Thu, 10 May 2001 09:56:56 EDT." <20010510135659.3B4A8199F0@mail.cse.psu.edu> From: Greg Hudson Date: Thu, 10 May 2001 10:25:11 -0400 Topicbox-Message-UUID: 9d6f1cd2-eac9-11e9-9e20-41e7f4b1d025 Rob Pike wrote: > Really? Unix sprintf tells you what it printed and snprintf tells > you what it *might* have printed? That's a scary inconsistency. They both return the length of the formatted string. Would it be any less scary for sprintf to return the length of the formatted string and snprintf to return something different and less informative? Edge cases introduce consistency choices. Better to avoid them, e.g. with asprintf().