Hacker News new | past | comments | ask | show | jobs | submit login

Could be. But wouldn't then displayln() require the same string placeholder? Be it "%s", or "{1}" or someting else.



displayln uses the massive _Generic in display_format to supply a large number of formatters automatically. [0]

[0] https://gist.github.com/shakna-israel/4fd31ee469274aa49f8f97...


I see. So when for a char pointer one needs to do

        printf("%p\n", v);
the Generic call must look like this

        displayln((const void *)v);
is it really better?


Or you could have the pointer be a pointer before you feed it to the function.

    void* v;
    v = ...;

    ...

    displayln(v);


The amount of ellipsis shows that your solution is just as heavy weight.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: