robertwb / issues-import-test

0 stars 0 forks source link

IF clauses inside definitions #42

Open robertwb opened 8 years ago

robertwb commented 8 years ago

Reported by jmickelin on 5 Jun 2008 08:23 UTC Normally, IF only works in the global scope. Defining conditional members of a struct necessitates redefining the whole structure:

IF UNAME_SYSNAME == "Windows":
      ctypedef struct ohmygod:
            int common
            int greece
ELSE:
      ctypedef struct ohmygod:
            int common
            float pelvis

This would be more convenient, especially for big structures:

ctypedef struct ohmygod:
     int common
     IF UNAME_SYSNAME == "Windows":
                 int greece
     ELSE:
                 float pelvis

Migrated-From: http://trac.cython.org/ticket/16

robertwb commented 8 years ago

Modified by robertwb on 19 Aug 2008 04:02 UTC

robertwb commented 8 years ago

Comment by robertwb on 19 Aug 2008 04:17 UTC These macros are not a pre-parser as in C, and so to do this one would have to do a bit of trickery...

robertwb commented 8 years ago

Comment by dagss on 18 Sep 2008 09:17 UTC I vote for resolving this as invalid; as discussed on the mailing list (sometimes August 2008) the efforts in this direction might be better concentrated on integrating other preprocessing languages with Cython instead (and slowly deprecating the IF statement altogether).