linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Noel Grandin <noelgrandin@gmail.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>
Subject: Re: [PATCH 02/12] Add parse_integer() (replacement for simple_strto*())
Date: Wed, 13 May 2015 15:19:03 +0300	[thread overview]
Message-ID: <CACVxJT97wzYXbRYPYdy4Vnf4D4FOc410w7HVGzXEghkBw6JbiA@mail.gmail.com> (raw)
In-Reply-To: <20150510135203.GC1717@p183.telecom.by>

[Answering to Noel Grandin, gmane sent email to list only]

> > int parse_integer(const char *s, unsigned int base, T *val);
> >
>
> I suspect splitting this into
>      parse_signed_int
> and
>     parse_unsigned_int
> (or some other equivalent names)
> will make the call-sites a lot easier to read.

parse_integer() is about two and only two points (everything else is
immaterial and technical details):
1) unified interface,
2) automatically fixing overflow bug based on type T.

Two interfaces in this situation is no different from having four.

C doesn't have generic functions so programmers get hardwired
to million of names all doing roughly the same but __b_c_e and
_Generic allows to mimic generic functions which is at least something.

  reply	other threads:[~2015-05-13 12:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-08 18:29 [PATCH 01/12] kstrto*: accept "-0" for signed conversion Alexey Dobriyan
2015-05-08 18:30 ` [PATCH 02/12] Add parse_integer() (replacement for simple_strto*()) Alexey Dobriyan
2015-05-08 20:46   ` Andrew Morton
2015-05-08 21:52     ` Rasmus Villemoes
2015-05-10 13:52     ` Alexey Dobriyan
2015-05-13 12:19       ` Alexey Dobriyan [this message]
2015-05-10 15:52   ` Noel Grandin
2015-07-09 19:28   ` Andrew Morton
2015-07-10  6:46     ` Alexey Dobriyan
2015-05-08 18:31 ` [PATCH 03/12] parse_integer: add runtime testsuite Alexey Dobriyan
2015-05-08 18:33 ` [PATCH 04/12] parse-integer: rewrite kstrto*() Alexey Dobriyan
2015-05-08 18:33 ` [PATCH 05/12] parse_integer: convert scanf() Alexey Dobriyan
2015-05-08 18:34 ` [PATCH 06/12] scanf: fix type range overflow Alexey Dobriyan
2015-05-08 18:35 ` [PATCH 07/12] parse_integer: convert lib/ Alexey Dobriyan
2015-05-08 18:35 ` [PATCH 08/12] parse_integer: convert mm/ Alexey Dobriyan
2015-05-08 18:36 ` [PATCH 09/12] parse_integer: convert fs/ Alexey Dobriyan
2015-05-08 18:37 ` [PATCH 10/37] parse_integer: convert fs/cachefiles/ Alexey Dobriyan
2015-05-08 18:39 ` [PATCH 11/12] parse_integer: convert ext2, ext3, ext4 Alexey Dobriyan
2015-05-08 18:40 ` [PATCH 12/12] parse_integer: convert fs/ocfs2/ Alexey Dobriyan

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=CACVxJT97wzYXbRYPYdy4Vnf4D4FOc410w7HVGzXEghkBw6JbiA@mail.gmail.com \
    --to=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=noelgrandin@gmail.com \
    --subject='Re: [PATCH 02/12] Add parse_integer() (replacement for simple_strto*())' \
    /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

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).