Re: atoi return



Anand Hariharan said:

On Sat, 11 Oct 2008 06:58:49 +0000, Richard Heathfield
<rjh@xxxxxxxxxxxxxxx> wrote:

CBFalconer said:

Bill Cunningham wrote:

I see. Must be a left over dinosaur like gets().

No. gets() is just unsafe regardless. atoi() can be used safely, but
why bother when you have strtol available.

In other words, it's a left over dinosaur. And so is gets(). Therefore,
it's a left over dinosaur like gets(). Which is what he said.


gets has been deprecated. It's got enough bad rep that compilers warn
about it. It's usage is likely to disappear. In that sense it is a
dinosaur.

atoi, OTOH, is as much a 'left over dinosaur' like say scanf.

Yes. They all are. Forgive me, but I don't see your point.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
.



Relevant Pages

  • Re: atoi return
    ... that's too big to hold in an int, ... atoi() can be used safely, ... it's a left over dinosaur. ... Google users: ...
    (comp.lang.c)
  • Re: atoi return
    ... that's too big to hold in an int, ... atoi() can be used safely, ... it's a left over dinosaur. ... is intended to convert a string value into an int value. ...
    (comp.lang.c)
  • Re: atoi return
    ... that's too big to hold in an int, it invokes undefined behavior. ... atoi() can be used safely, ... it's a left over dinosaur. ...
    (comp.lang.c)
  • Re: atoi return
    ... it's a left over dinosaur like gets. ... No, gets is never safe. ... atoi is always safe if you limit the input string to ... that there could just as easily be a bug in one of a million places ...
    (comp.lang.c)
  • Re: atoi return
    ... but why bother when you have strtol available. ... it's a left over dinosaur like gets. ... No, gets is never safe. ... atoi is always safe if you limit the input string to ...
    (comp.lang.c)