IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 19 years ago

Closed 19 years ago

#893 closed defect (fixed)

Add 'ifndef' to ohana.h to avoid multiple MIN, MAX, SWAP definitions

Reported by: Michael Wood-Vasey Owned by: eugene
Priority: high Milestone:
Component: Ohana Version: unspecified
Severity: trivial Keywords:
Cc:

Description

The MIN, MAX, and SWAP macros in 'ohana.h' should be wrapped if 'ifndef's to avoid conflicts with other headers that define these common macros. Sorry I didn't do up a .diff file, but in the installed copy of 'ohana.h' (which may not be quite the same as the copy in the source), replace lines 39-41 with

/* Some useful macros: MIN, MAX, SWAP

If they're already defined,

we'll just assume they were defined the same way. */

# ifndef MIN
# define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
# endif /* MIN */
# ifndef MAX
# define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
# endif /* MAX */
# ifndef SWAP
# define SWAP(X,Y) {double tmp=(X); (X) = (Y); (Y) = tmp;}
# endif /* SWAP */

Change History (1)

comment:1 by eugene, 19 years ago

Resolution: fixed
Status: newclosed

done, in the CVS head

I should probably use a safe namespace for these defines in case they are inconsistent with someone else's definition. But, that is too painful at the moment.

Note: See TracTickets for help on using tickets.