Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why not use dprintf instead of nprintf? #33

Closed
mstewartgallus opened this issue Jul 28, 2014 · 1 comment
Closed

Why not use dprintf instead of nprintf? #33

mstewartgallus opened this issue Jul 28, 2014 · 1 comment

Comments

@mstewartgallus
Copy link

It's in POSIX ≥ 2008.

@riolet
Copy link
Collaborator

riolet commented Jul 28, 2014

Hi Steve,

From the man page:

   These  functions  are  GNU extensions, not in C or POSIX.  Clearly, the
   names were badly chosen.  Many systems (like MacOS)  have  incompatible
   functions called dprintf(), usually some debugging version of printf(),
   perhaps with a prototype like

   void dprintf (int level, const char *format, ...);

   where the first parameter is  a  debugging  level  (and  output  is  to
   stderr).  Moreover, dprintf() (or DPRINTF) is also a popular macro name
   for a debugging printf.  So, probably, it is better to avoid this func-
   tion in programs intended to be portable.

   A better name would have been fdprintf().

If you are willing to do a pull request with the correct #ifdef macros
defining, say FDPRINTF, to gracefully fall back to our home brewed
nprintf(), we could certainly use it.

On Mon, Jul 28, 2014 at 2:30 PM, Steven Stewart-Gallus <
notifications@github.com> wrote:

It's in POSIX >= = 2008.


Reply to this email directly or view it on GitHub
#33.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant