Re: [PATCH 02/12] Add parse_integer() (replacement for simple_strto*())
From: Alexey Dobriyan
Date: Wed May 13 2015 - 08:19:09 EST
[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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/