News for hackers. Stuff that matters.
Re:PyPy is faster than C, again: string formatting by onedognight on Tuesday August 02, 2011 @05:11PM (#2838715)

    char x[44];
    sprintf(x, "%d %d", i, i);
This is fine, except you can't even return x from this function, a more fair comparison might be:

     char * x = malloc(44 * sizeof(char));
     sprintf(x, "%d %d", i, i);*
There is a standard (C99) way to do this: asprintf(3).

    char *x;
    asprintf(&x, "%d %d", i, i);
    return x;
Re:PyPy is faster than C, again: string formatting by tedunangst on Tuesday August 02, 2011 @05:53PM (#2838860)
There is no asprintf function in my copy of the C99 standard.
Re:PyPy is faster than C, again: string formatting by onedognight on Tuesday August 02, 2011 @06:47PM (#2839016)
Sorry, you are correct; I mis-read the man page. It is however in at least glibc and Darwin/FreeBSD's libc.
Re:PyPy is faster than C, again: string formatting by supersillyus on Tuesday August 02, 2011 @06:34PM (#2838979)
asprintf is a GNU extension, I believe.