lkml.org 
[lkml]   [2015]   [May]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 02/12] Add parse_integer() (replacement for simple_strto*())
From
[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.


\
 
 \ /
  Last update: 2015-05-13 14:41    [W:0.055 / U:0.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site