9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Bakul Shah <bakul@bitblocks.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] atol() bug
Date: Mon, 11 Mar 2013 17:40:09 -0700	[thread overview]
Message-ID: <20130312004009.0D736B834@mail.bitblocks.com> (raw)
In-Reply-To: Your message of "Mon, 11 Mar 2013 19:55:53 EDT." <71d5bd1d0ba63c9e3643e932561e1a69@ladd.quanstro.net>

On Mon, 11 Mar 2013 19:55:53 EDT erik quanstrom <quanstro@quanstro.net> 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 <sstallion@gmail.com> 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?



  parent reply	other threads:[~2013-03-12  0:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-11 22:09 Bakul Shah
2013-03-11 22:44 ` Steven Stallion
2013-03-11 22:55   ` Bakul Shah
2013-03-11 23:55     ` erik quanstrom
2013-03-12  0:25       ` Kurt H Maier
2013-03-12  0:40       ` Bakul Shah [this message]
2013-03-12 21:05         ` a

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130312004009.0D736B834@mail.bitblocks.com \
    --to=bakul@bitblocks.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).