[Cython] Status

Stefan Behnel stefan_ml at behnel.de
Sat Feb 1 10:26:49 EST 2020


John Skaller2 schrieb am 01.02.20 um 15:38:
> On 1 Feb 2020, at 20:00, Greg Ewing wrote:
>> On 1/02/20 3:29 pm, John Skaller2 wrote:
>>> But the all hell breaks loose for pointers. Your hack only
>>> works for rvalues.
>>
>> Yes, using these it's possible for Cython to accept something
>> that will later be rejected by the C compiler. It's not perfect,
>> but it gets the job done most of the time.
> 
> My concern is that the C compiler wont reject it, the program
> will corrupt data or crash:
> 
> 	int32_t *x=..; *x = 42;
> 	int64_t *x=..; *x = 42;
> 
> The C compiler will overwrite 4 or 8 bytes. Which one matters.

As stated before, the C compiler will see the correct definition of the
types in the header files. And the generated C code will use the same type
names that the user had in their source code. "int64_t" will not magically
become "int" there.

Stefan


More information about the cython-devel mailing list