From mboxrd@z Thu Jan 1 00:00:00 1970 To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> In-reply-to: Your message of "Mon, 11 Mar 2013 19:55:53 EDT." <71d5bd1d0ba63c9e3643e932561e1a69@ladd.quanstro.net> References: <20130311220907.46195B82A@mail.bitblocks.com> <20130311225516.2EF5CB82A@mail.bitblocks.com> <71d5bd1d0ba63c9e3643e932561e1a69@ladd.quanstro.net> Date: Mon, 11 Mar 2013 17:40:09 -0700 From: Bakul Shah Message-Id: <20130312004009.0D736B834@mail.bitblocks.com> Subject: Re: [9fans] atol() bug Topicbox-Message-UUID: 27753a84-ead8-11e9-9d60-3106f5b1d025 On Mon, 11 Mar 2013 19:55:53 EDT erik quanstrom wrote: > On Mon Mar 11 18:56:04 EDT 2013, bakul@bitblocks.com wrote: > > On Mon, 11 Mar 2013 15:44:05 PDT Steven Stallion wrote: > > > from atof(2): > > > > > > BUGS > > > Atoi, atol, and atoll accept octal and hexadecimal numbers > > > in the style of C, contrary to the ANSI specification. > > > > This BUG is obviously very easy to fix but it hasn't been.... > > Any good reason for this or just laziness? Anyway, more cruft > > to remember (and debug when porting software). > > there is a deep-seated assumption on the system that strtou?ll? accept > hex and octal. the fact that it's in the BUG section rather than fixed > means there are good reasons for not fixing it. I assume you meant to write atou?ll? as strtou?ll? *do* accept all three forms even in ANSI. I am saying either make it ANSI compatible (my choice) or at least fix the wording in the atof(2) that says "string of decimal digits". If the behavior is intended why not say so upfront and remove the BUGS section (or rename it to something else). > if you were to make this change, i would be surprised if you could > boot your kernel. This is easy. Replace atou?ll?(x) with Atou?ll?(x) and map these to the equivalent strou?ll?(x, nil, 0). plan9 strings are not just ASCII anymore so the 'a' prefix makes less sense now! Why not call them stou?ll? or utou?ll? or something?