On Tue, Oct 6, 2009 at 5:45 AM, Robert Bradshaw <rober...@math.washington.edu> wrote: > On Oct 5, 2009, at 1:18 PM, Lisandro Dalcin wrote: > >> Well, I'm hacking on supporting C++ complex, but have some questions >> >> Robert: why did you bothered about using 'infix' operators instead of >> using macros when c99 complex is on? Just to generate more readable C >> code? Could this be changed to always use the macros? > > Yep, that's probably why. Is there an advantage to always using the > macros. >
Was that a question? Then I think yes, we could potentially select at C compile type the kind of complex numbers to use. For this to be possible, the rest of the code has to be identical...Well, this would require to always promote int/float to complexes, but for C99/C++ that can also be done with a macro (no need at all of using a inline function as currently) > > So, there's really three types of complex numbers: > > - Native (struct-based) > - c99 (valid for C) > - c++ (valid for C++) > Yes, but C99 complexes could be used in C++ (for example, IBM compilers seems to let you use C99 complexes in C++, look at the very end of: http://publib.boulder.ibm.com/infocenter/comphelp/v7v91/index.jsp?topic=/com.ibm.vacpp7a.doc/language/ref/clrc03complex_types.htm) > Is there any case where the latter can both be used? Well, you can always compile your C code with C++... And I do think that we should support C compile time selection of the kind of complex to use.. Is this a nonsense? If we can support that, why not? > Rather than two > boolean directives, I think this calls for a single directive that > takes three values. OK, makes sense, of course, so they values should be a string in 'c99', 'c++', 'xxx' (please choose 'xxx', you are our BDLF, the position comes with responsibilities) > Also, if complex.h is imported, we want > compatible complex numbers (whether that's c99 or c++ type). > Well, that's going to be hard in the C++ case... -- Lisandro Dalcín --------------- Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC) Instituto de Desarrollo Tecnológico para la Industria Química (INTEC) Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET) PTLC - Güemes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594 _______________________________________________ Cython-dev mailing list Cython-dev@codespeak.net http://codespeak.net/mailman/listinfo/cython-dev