LWN.net Logo

A turning point for GNU libc

A turning point for GNU libc

Posted Mar 29, 2012 12:57 UTC (Thu) by mina86 (subscriber, #68442)
In reply to: A turning point for GNU libc by nix
Parent article: A turning point for GNU libc

gets() is actually removed in C11. The difference between gets() and strcpy() though is that in the letter you can validate the length before the call, while in the former you have no way of knowing in advance how long the line you are about to read from stdin is.


(Log in to post comments)

A turning point for GNU libc

Posted Mar 29, 2012 20:30 UTC (Thu) by nix (subscriber, #2304) [Link]

Agreed... but gets() was in C89, and C99, and is in C++11, and the deprecation warning was present long before C99 or C++11 existed. So we *do* deprecate stuff in ANSI C, but only if it really does suck (like gets()).

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds