On Tue, Jul 7, 2009 at 2:30 PM, Dag Sverre
Seljebotn<[email protected]> wrote:
> Lisandro Dalcin wrote:
>> On Tue, Jul 7, 2009 at 10:47 AM, Dag Sverre
>> Seljebotn<[email protected]> wrote:
>>> Or that #333-like behaviour will *only* be done if you use a "?"? If so,
>>> for what gain? -- some fewer lines of C code? Why does it hurt to
>>> "second-guess the user", as you put it in the OP?
>>>
>>
>> Because of your fist question and my previous comment. Second-guessing
>> will be a bad thing...
>
> I disagree, I think second-guessing is wonderful. (That is, if you want
> me to understand this, you must explain more -- of course, it is not a
> necessity that I understand this.)
>
> If the only effect is to save a few lines of C and a few cycles of CPU
> time for gcc, then I don't think it is worth it to complicate the language.
>
It is not about saving lines of CPU cycles... It's about providing a
way for users to say: Hey! This extern ctypedef is EXACTLY what I
declared Why is Cython trying to be smart and second-guess me, I'm
adult enough ...
Moreover, what I'm proposing is 100 % backwards, and the change to the
languaje is rather minimal...
Dag, are you 100 % confident that treating all extern ctypedef
integrals as unknown-size will not break something or let
overflow/truncation errors pass silently?
> I do think this could be good to have if we inserted code at module init
> time to raise exceptions if sizeof(foo) != sizeof(bar) for all external
> typedefs, so that exactness is *enforced* in those situations. (That may
> break some backwards compatability but I think it is OK myself.) If that
> approach is also taken, at the same time, and this isn't done until
> 0.12, then +1.
>
Sorry, I'm confused here... In which situation do you want to *enfoce*
sizeof(foo) == sizeof(bar) ? Can you provide some code snippet? Do you
mean that if I write this in mpi4py
cdef extern from "mpi.h":
ctypedef signed long MPI_Aint
then mpi4py will fail to import on Win64 (MPI_Aint is a address-sized
signed integral)?
> But otherwise I'm -1 since it adds thing to the language without any
> benefit at all (that I can see).
>
>> BTW, this likely should affect you work on member descriptor, right?
>
> It already second-guesses now; the only effect would be to speed up gcc
> compilation with a totally insignificant amount per member; not worth
> the time to make the likely trivial commit on Cython IMO.
>
I agree on this particular point... member descriptors is something
that is not worth changing. Or perhaps it would make sense to change
the whole thing? We could use the current size-agnostic handling of
ctypedef's for ALL integral types, even the builtin ones... That would
certainly make the Cython codebase simpler, right?
--
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
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev