This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug manual/16776] Endless loop in strtol example


https://sourceware.org/bugzilla/show_bug.cgi?id=16776

--- Comment #5 from Michael Kerrisk <mtk.manpages at gmail dot com> ---
(In reply to Olaf van der Spek from comment #4)
> On Wed, Apr 30, 2014 at 5:55 AM, mtk.manpages at gmail dot com
> <sourceware-bugzilla@sourceware.org> wrote:
> > https://sourceware.org/bugzilla/show_bug.cgi?id=16776
> >
> > --- Comment #3 from Michael Kerrisk <mtk.manpages at gmail dot com> ---
> > (In reply to Olaf van der Spek from comment #2)
> >> Bugs in examples are bad, they *will* be copied into real code.
> >
> > I'mquite agree.
> >
> > But, Olaf, why not just provide a patch?
> 
> On the mailing list I was trying to argue that strtol usage is too
> hard to get right and this is one example of that.
> I requested a new API but it was rejected. Now I'm curious how glibc
> developers will handle this correctly.
> 
> > int sum_ints_from_string(char * str, int &result)
> 
> &? This isn't C++ is it?
> 
> which returns 0 on failure, 1 on success.
> 
> That's the opposite of normal.

Olaf, why did you raise this bug? Either you care about seeing the documention
fixed or you do not. 

Rather than just complaining, and expecting someone else to fix it, it would be
more constructive to propose a patch that fixes the problem. I can't help but
feel a little irritated that when I point that out, you digress into quibling
about details^Werrors of language syntax and relative API choices.

(And, yes, strtol() is not the most comfortable API, but the example can be
corrected using that API.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]