LWN.net Logo

What If I Don't Actually Like My Users?

What If I Don't Actually Like My Users?

Posted Apr 4, 2008 20:38 UTC (Fri) by xbobx (subscriber, #51363)
In reply to: What If I Don't Actually Like My Users? by nix
Parent article: What If I Don't Actually Like My Users?

> Why oh why were gets(), puts() and the other pre-stdio functions not quietly retired when stdio was invented? puts() is still used all the time. In fact, for the almost-simplest of programs:

#include <stdio.h>
int main(void) {
    printf("hi\n");
    return 0;
}
gcc 4.1.2 on my system generates the following:
sub    $0x8,%rsp
mov    $0x4005f8,%edi
callq  400430 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
retq   
If you use anything more complicated than a constant static string it will actually call printf().


(Log in to post comments)

What If I Don't Actually Like My Users?

Posted Apr 4, 2008 20:49 UTC (Fri) by nix (subscriber, #2304) [Link]

Well, yeah, but as the analogue of gets(), entirely redundant to fputs(), 
both should have gone if either do, and gets() certainly should have gone.

But it didn't.

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