From: William S F. <ws...@fu...> - 2011-08-04 05:36:47
|
On 03/08/11 15:26, Stefan Zager wrote: > On Thu, Jul 28, 2011 at 4:29 PM, Shi Hu <fin...@gm... > <mailto:fin...@gm...>> wrote: > > > Hi, > > I am trying to build a bridge between Python and C. I am not sure why I > can't do this in my interface/header file: int array[(int) 3 > 2]. > > In another word, it seems that SWIG can't take boolean expression as the > size of an array. But this is legitimate in C. > > For details, when I do: swig -python example.i, SWIG gives example.i:9: > Error: Syntax error in input(1) as the error message. > > I don't think this is a big surprise. For SWIG to process that > correctly, its parser would have to be a great deal more complex -- it > would have to evaluate the expression '(int) 3 > 2'. I think that's > beyond the scope of this project. > Indeed the expression is unusual, but the goal of SWIG is to parse any valid C/C++, so this ought to be fixed. However, given the tiny number of SWIG developers and the fact it is an obscure case, it isn't likely to get fixed in a rush though by any developers. Anyone can debug and fix the SWIG source though, so patches are always welcome. William |