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)