[Pyrex] Pyrex idioms and optimizations?

Chris Mellon arkanes at gmail.com
Thu Jul 26 21:26:58 CEST 2007


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).



More information about the Pyrex mailing list