Opened 16 years ago

Closed 16 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

Description

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=474415

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 by warmerdam, 16 years ago

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))
#endif

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

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 by frankie, 16 years ago

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

comment:3 by Even Rouault, 16 years ago

Resolution: fixed
Status: newclosed

Francesco,

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.