There is no reason to include windows.h
at all, as there is nothing Windows-specific in this code (aside from the WORD
type, which is not really a good way to do things in this day and age).
Doing such things as macros is dangerous and unnecessary; parameters aren't necessarily single values without side effects. And if it's in a header or if your compiler supports link-time optimization, the compiler can optimize it into an inline anyway. The only thing a macro buys you in this case is type-independence but it's not doing it in a particularly safe way here, and you're specifying the type in the macro so you lose that as well.
You might want to improve the condition to allow for the extents to be in any order, e.g.:
static bool between(int n, int x, int y) {
return (x <= n && n <= y) || (y <= n && n <= x);
}
(static bool
is if this implementation is kept in a header, so that non-optimizing compilers won't have multiple instances of the same symbol at link time.)
And, finally, for something so simple and obvious as this, it's not really necessary to put into a library.
EOL
is a common abbreviation of end of line, such as\n
in Unix and\r\n
in windows... \$\endgroup\$