[Pyrex] Pyrex idioms and optimizations?
Lenard Lindstrom
len-l at telus.net
Sat Jul 28 19:00:57 CEST 2007
Chris Mellon wrote:
> On 7/26/07, Sven Berkvens-Matthijsse <sven at pyrex.berkvens.net> wrote:
>
>>> Chris Mellon wrote:
>>>
>>>> On 7/26/07, William Stein <wstein at gmail.com> wrote:
>>>>
>>>> MSVC is a C++ compiler, and only incidently a C compiler, so the
>>>> inline specifications that cython generates are syntax errors there.
>>>> Using a macro for it so it be a noop on MSVC would probably be best.
>>>>
>>>>
>>> Is VC 7 C99 compliant? Maybe it needs some command line option set.
>>> Anyway "inline" is spelled "__inline" (two leading underscores) in
>>> VC 6. That should still work.
>>>
>> Wouldn't it work if you say, at the beginning of each generated file:
>>
>> #ifdef __cplusplus
>> extern "C" {
>> #endif
>>
>> and at the end:
>>
>> #ifdef __cplusplus
>> }
>> #endif
>>
>> This should force a C++ compiler to treat the code as C, not C++. I
>> would've thought that the C++ compiler would understand that it was
>> handling C code from the file's extension ".c", but apparently that
>> isn't the case with MS tools.
>>
>>
>
> MSVC does know it's executing in a C context, it simply doesn't care
> (much. There's a couple things it does differently).
>
>
>
MSVC knows the difference. CPython is written in ANSI C and compiled
with MSVC 7 on Windows. *inline* is traditionally a C++ reserved word.
--
Lenard Lindstrom
<len-l at telus.net>
More information about the Pyrex
mailing list