Hi Kevin,

On 2026-02-10T11:05:51+0800, Kevin J. McCarthy wrote:
> Debug statements have been completely converted from dprint() to dprintf()

dprintf() is an unfortunate name, since there's a GNU/BSD libc API
--standardized in POSIX.1-2008-- with that name:

     int dprintf(int fd, const char *restrict format, ...);

     The function dprintf() is the same as  fprintf()  except  that  it
     outputs to a file descriptor, fd, instead of to a stdio(3) stream.

In fact, it's especially confusing because both take an int as their
first argument.  At first, I thought you were using the standard one.

We could call it dbgprintf() maybe?  Or maybe gprintf() if you want it
short, as 'g' is the usual one letter for meaning debug (e.g., -Og)?

> (and deprintf()).

About deprintf(), I also have naming concerns.

eprintf() is a relatively common wrapper around fprintf(3) that prints
to stderr.

        #define eprintf(...) fprintf (stderr, __VA_ARGS__)

See for example
<https://gcc.gnu.org/onlinedocs/gcc-3.1.1/cpp/Variadic-Macros.html>.

> The latter version no longer requires a newline, and
> automatically logs function, file, and line number. deprintf() additionally
> logs the errno for system call failures.

I've written a similar function in other project, and I called it
fprinte() (replacing the 'f' by the 'e').  Maybe we could call this
dbgprinte().

I could send a couple of patches for that.


Have a lovely day!
Alex

> 
> dprint() has been removed, so please update your patches to use that.
> 
> -- 
> Kevin J. McCarthy
> GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA



-- 
<https://www.alejandro-colomar.es>

Attachment: signature.asc
Description: PGP signature

Reply via email to