Index | Thread | Search

From:
"Theo de Raadt" <deraadt@openbsd.org>
Subject:
Re: watch(1) - periodically execute a command and display its output
To:
Job Snijders <job@openbsd.org>
Cc:
tech@openbsd.org
Date:
Mon, 19 May 2025 18:42:22 -0600

Download raw body.

Thread
+#define MAX(x, y)      ((x) > (y) ? (x) : (y))
+#define MIN(x, y)      ((x) < (y) ? (x) : (y))

programs must not do this, it could appear in the namespace with sys/param.h
on other systems and/or attract people to including that.  To avoid this please
do as we did everywhere else, and convert the program-specific uses to MAXIMUM()
and MINIMUM().  You define these two alternative named macros, the use them.

Probably a good time to mention that these are fragile.  People using them
often forget about signed vs unsigned types, and some pretty subtle bugs
show up...