On May 20, 2009, at 10:17 PM, Dag Sverre Seljebotn wrote:

> Kurt wrote:
>> On Wed, May 20, 2009 at 1:44 PM, Dag Sverre Seljebotn
>> <[email protected]> wrote:
>>> Robert Bradshaw wrote:
>>>> On May 20, 2009, at 5:49 AM, Dag Sverre Seljebotn wrote:
>>>>
>>>>> I did some digging and decided to share what I found, since  
>>>>> this only
>>>>> occurs on a specific compiler and is thus hard to discover.
>>>>>
>>>>> Kurt, pay attention, as I just recommended that you do this :-)
>>>>>
>>>>> Apparently code like this:
>>>>>
>>>>>   (foo_struct){0, 0, NULL}
>>>>>
>>>>> is a C99 extension, so we probably shouldn't use it.  
>>>>> Furthermore it
>>>>> makes things fail in g++ 4.2.4 (but not in earlier or later  
>>>>> versions I
>>>>> tried -- anyway, 4.2.4 is the one currently on sage.math).
>>>>
>>>> I think it's fine in C (not sure if it's just gcc), but has issues
>>>> with C++. We ran into this issue before with cdef optional  
>>>> arguments.
>>>
>>> The link I posted lists it as a C99 extension though:
>>>
>>> """
>>> As an extension, GCC supports compound literals in C89 mode and  
>>> in C++.
>>> """
>>>
>>> http://gcc.gnu.org/onlinedocs/gcc-3.3.1/gcc/Compound-Literals.html
>>
>> So was a verdict reached?  Can compound literals be used?  (They'd be
>> a mote easier for the coercion I'm working on in #299, but one can
>> always just use an inline function returning a struct.)
>
> Note that if you create a constructor function like this:
>
> static INLINE MyStruct create_MyStruct(int a, int b) {
>     MyStruct r; r.a = a; r.b = b; return r;
> }
>
> then it shouldn't make much difference IMO. (You can create such a
> function using utility code.)
>
> (Judging by how my previous attempt to use a feature which was  
> shown to be
> C99 only was recieved, I have a feeling this pretty much settles it.)


I'd like to not require much more than Python itself requires.

- Robert

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to