Opened 16 years ago

Closed 16 years ago

#1240 closed bug (fixed)

Invalid preprocessor condition testing value of GEOS_VERSION_MAJOR

Reported by: mloskot Owned by: nobody
Priority: major: does not work as expected Milestone:
Component: Build/Install Version: Trunk
Keywords: geos preprocessor Cc:
Must Fix for Release: No Platform: OS X
Platform Version: 10.5 Awaiting user input: no

Description

In file qgsgeometry.h, line 27, preprocessir #if-def testing major version number is incorrect:

#if GEOS_VERSION_MAJOR<3

If the tested macro is not defined, it always evaluates to true. Small test:

  • Incorrect condition due to the incompleteness
    //#define ABC 3   // ABC not defined
    
    #if (ABC < 4)
    #  error XXX      // always printed, despite ABC undefined
    #endif
    
    int main() { return 0; }
    
  • Correct #ifdef condition should include 2 tests together
    //#define ABC 3
    
    #if defined(ABC) && (ABC < 4)
    #  error XXX
    #endif
    
    int main() { return 0; }
    

Change History (1)

comment:1 by jef, 16 years ago

Resolution: fixed
Status: newclosed

also fixed with r9133

Note: See TracTickets for help on using tickets.