*printf

What’s the longest named *printf function? Amongst the GNU libraries it appears to be xvasprintf.

x aborts on allocation failure
v takes va_list of arguments
a allocates space for return string
s prints to a string
print formatted

It’s a shame, as Eric suggests in this email, that we don’t have xvasnprintf.

2 Comments

Filed under Uncategorized

2 responses to “*printf

  1. *sigh*

    *printf and *scanf naming conventions solve a problem that hasn’t really existed since at least the 1980s: getting the most meaningful information into the fewest possible function-name letters. C++ iostreams would have solved this problem, if they weren’t C++ (which, in comparison, make COBOL seem terse and APL seem legible to the casual reader). Java, of course, had to do C++ one better.

    • rich

      iostreams mainly suck because they can’t be internationalized, whereas at least with *printf you can write:

      printf (_("this will be translated into %s\n"), lang);
      

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s