Opened 13 years ago

Closed 13 years ago

#2317 closed defect (fixed)

C++ issue on some archs with GCC 4.3

Reported by: frankie Owned by: warmerdam
Priority: normal Milestone: 1.5.2
Component: OGR_SF Version: 1.5.0
Severity: normal Keywords: geojson
Cc: warmerdam


Please avoid the use of such common used max/min macros. It is much better using some unique names such as OGR_max/OGR_min to avoid name clashes.

Change History (3)

comment:1 Changed 13 years ago by warmerdam

Cc: warmerdam added
Component: defaultOGR_SF
Keywords: geojson added
Milestone: 1.5.2
Version: unspecified1.5.0

I can confirm that geojson/jsonc/bits.h defines min and max macros like this:

#ifndef min
#define min(a,b) ((a) < (b) ? (a) : (b))

#ifndef max
#define max(a,b) ((a) > (b) ? (a) : (b))

This is a dangerous practice. This needs to be reworked to do something else, likely just use the MIN/MAX defined in cpl_port.h or rename the macros something specific. Matuesz, if you don't have time to deal with this shortly, let me know and I'll have Chris address it.

comment:2 Changed 13 years ago by frankie

This seems fixed in trunk, I backported a patch in 1.5.1-2 on Debian, thanks. See changesets 13700 and 13701.

comment:3 Changed 13 years ago by Even Rouault

Resolution: fixed
Status: newclosed


I've backported r13700 and r13701 from trunk to branches/1.5 (r14283). So you should be able to drop your patch when packaging 1.5.2 ;-)

Note: See TracTickets for help on using tickets.