Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Dev

Does trunk still support any compilers that *don't* allow declaring variables after code?

 

 

Python dev RSS feed   Index | Next | Previous | View Threaded


larry at hastings

May 2, 2012, 1:43 AM

Post #1 of 11 (207 views)
Permalink
Does trunk still support any compilers that *don't* allow declaring variables after code?

Right now the CPython trunk religiously declares all variables at the
tops of scopes, before any code, because this is all C89 permits. Back
in the 90s all the C compilers took a page out of the C++ playbook and
independently, but nearly without exception, extended the language to
allow you declaring new variables after code statements. This became an
official part of the language with C99 back in 1999.

It's now 2012. As I step out of my flying car onto the moving walkway
that will glide me noiselessly into my platform sky dome... I can't help
but think that we're a bit hidebound, slavishly devoting ourselves to
C89. CPython 3.3 drops support for VMS, OS/2, and even Windows 2000.

I realize we can't jump to C99 because of A Certain Compiler. (Its name
rhymes with Bike Row Soft Frizz You All See Muss Muss.) But even that
compiler added this extension in the early 90s.

Do we officially support any C compilers that *don't* permit
"intermingled variable declarations and code"? Do we *unofficially*
support any? And if we do, what do we gain?


Just itching to pull some local macro hijinx, is all,


//arry/


solipsis at pitrou

May 2, 2012, 2:56 AM

Post #2 of 11 (197 views)
Permalink
Re: Does trunk still support any compilers that *don't* allow declaring variables after code? [In reply to]

On Wed, 02 May 2012 01:43:32 -0700
Larry Hastings <larry [at] hastings> wrote:
>
> I realize we can't jump to C99 because of A Certain Compiler. (Its name
> rhymes with Bike Row Soft Frizz You All See Muss Muss.) But even that
> compiler added this extension in the early 90s.
>
> Do we officially support any C compilers that *don't* permit
> "intermingled variable declarations and code"? Do we *unofficially*
> support any? And if we do, what do we gain?

Well, there's this one called MSVC, which we support quite officially.

Regards

Antoine.


_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


anacrolix at gmail

May 2, 2012, 6:37 AM

Post #3 of 11 (194 views)
Permalink
Re: Does trunk still support any compilers that *don't* allow declaring variables after code? [In reply to]

On May 2, 2012 6:00 PM, "Antoine Pitrou" <solipsis [at] pitrou> wrote:
>
> On Wed, 02 May 2012 01:43:32 -0700
> Larry Hastings <larry [at] hastings> wrote:
> >
> > I realize we can't jump to C99 because of A Certain Compiler. (Its name
> > rhymes with Bike Row Soft Frizz You All See Muss Muss.) But even that
> > compiler added this extension in the early 90s.
> >
> > Do we officially support any C compilers that *don't* permit
> > "intermingled variable declarations and code"? Do we *unofficially*
> > support any? And if we do, what do we gain?
>
> Well, there's this one called MSVC, which we support quite officially.

Not sure if comic genius or can't rhyme.

>
> Regards
>
> Antoine.
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev [at] python
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
http://mail.python.org/mailman/options/python-dev/anacrolix%40gmail.com


stefan_ml at behnel

May 2, 2012, 6:56 AM

Post #4 of 11 (198 views)
Permalink
Re: Does trunk still support any compilers that *don't* allow declaring variables after code? [In reply to]

Matt Joiner, 02.05.2012 15:37:
> On May 2, 2012 6:00 PM, "Antoine Pitrou" wrote:
>> On Wed, 02 May 2012 01:43:32 -0700
>> Larry Hastings <larry [at] hastings> wrote:
>>>
>>> I realize we can't jump to C99 because of A Certain Compiler. (Its name
>>> rhymes with Bike Row Soft Frizz You All See Muss Muss.) But even that
>>> compiler added this extension in the early 90s.
>>>
>>> Do we officially support any C compilers that *don't* permit
>>> "intermingled variable declarations and code"? Do we *unofficially*
>>> support any? And if we do, what do we gain?
>>
>> Well, there's this one called MSVC, which we support quite officially.
>
> Not sure if comic genius or can't rhyme.

I'm not sure if MSVC and MSVC++ are the same thing, but I surely remember
reports by MSVC users only a few years ago that Cython generated C code
contained a declaration after an executed code at some point, and that
failed to compile for them. So, assuming that MSVC++ "added this extension
in the early 90s" and didn't remove it in the meantime, they must be two
different things.

Stefan

_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


rdmurray at bitdance

May 2, 2012, 7:12 AM

Post #5 of 11 (195 views)
Permalink
Re: Does trunk still support any compilers that *don't* allow declaring variables after code? [In reply to]

On Wed, 02 May 2012 21:37:35 +0800, Matt Joiner <anacrolix [at] gmail> wrote:
> On May 2, 2012 6:00 PM, "Antoine Pitrou" <solipsis [at] pitrou> wrote:
> >
> > On Wed, 02 May 2012 01:43:32 -0700
> > Larry Hastings <larry [at] hastings> wrote:
> > >
> > > I realize we can't jump to C99 because of A Certain Compiler. (Its name
> > > rhymes with Bike Row Soft Frizz You All See Muss Muss.) But even that
> > > compiler added this extension in the early 90s.
> > >
> > > Do we officially support any C compilers that *don't* permit
> > > "intermingled variable declarations and code"? Do we *unofficially*
> > > support any? And if we do, what do we gain?
> >
> > Well, there's this one called MSVC, which we support quite officially.
>
> Not sure if comic genius or can't rhyme.

I had trouble with that rhyme, and I (unlike Antoine) am a native
English speaker.

--David
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


curt at hagenlocher

May 2, 2012, 7:13 AM

Post #6 of 11 (192 views)
Permalink
Re: Does trunk still support any compilers that *don't* allow declaring variables after code? [In reply to]

On Wed, May 2, 2012 at 6:56 AM, Stefan Behnel <stefan_ml [at] behnel> wrote:

> I'm not sure if MSVC and MSVC++ are the same thing, but I surely remember
> reports by MSVC users only a few years ago that Cython generated C code
> contained a declaration after an executed code at some point, and that
> failed to compile for them. So, assuming that MSVC++ "added this extension
> in the early 90s" and didn't remove it in the meantime, they must be two
> different things.


I believe you need to tell MSVC that it's a C++ source file by using "/Tp"
in order to make this work. And of course, there would be other
ramifications for doing that.

-Curt


dirkjan at ochtman

May 4, 2012, 8:08 AM

Post #7 of 11 (176 views)
Permalink
Re: Does trunk still support any compilers that *don't* allow declaring variables after code? [In reply to]

On Wed, May 2, 2012 at 10:43 AM, Larry Hastings <larry [at] hastings> wrote:
> Do we officially support any C compilers that *don't* permit "intermingled
> variable declarations and code"?  Do we *unofficially* support any?  And if
> we do, what do we gain?

This might be of interest:

http://herbsutter.com/2012/05/03/reader-qa-what-about-vc-and-c99/?nope

Specifically, apparently MSVC 2010 supports variable declarations in
the middle of a block in C.

Also, since full C99 support won't be coming to MSVC, perhaps Python
should move to compiling in C++ mode?

Cheers,

Dirkjan
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


brian at python

May 4, 2012, 8:14 AM

Post #8 of 11 (172 views)
Permalink
Re: Does trunk still support any compilers that *don't* allow declaring variables after code? [In reply to]

On Fri, May 4, 2012 at 10:08 AM, Dirkjan Ochtman <dirkjan [at] ochtman> wrote:
> On Wed, May 2, 2012 at 10:43 AM, Larry Hastings <larry [at] hastings> wrote:
>> Do we officially support any C compilers that *don't* permit "intermingled
>> variable declarations and code"?  Do we *unofficially* support any?  And if
>> we do, what do we gain?
>
> This might be of interest:
>
> http://herbsutter.com/2012/05/03/reader-qa-what-about-vc-and-c99/?nope
>
> Specifically, apparently MSVC 2010 supports variable declarations in
> the middle of a block in C.
>
> Also, since full C99 support won't be coming to MSVC, perhaps Python
> should move to compiling in C++ mode?

After seeing that same article yesterday and having the VS2010 port
open, I tried this and it appears it won't work without significant
code changes at least as far as I saw. I enabled /TP on the pythoncore
project and got over 1363 errors.

I don't have the time to figure it out right now, but I'll look more
into it later.
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


martin at v

May 4, 2012, 10:03 AM

Post #9 of 11 (170 views)
Permalink
Re: Does trunk still support any compilers that *don't* allow declaring variables after code? [In reply to]

> I don't have the time to figure it out right now, but I'll look more
> into it later.

I recently did an analysis here:

http://mail.python.org/pipermail/python-dev/2012-January/115375.html

The motivation for C++ compilation is gone meanwhile, as VS now supports
C in WinRT apps quite well. However, the conclusions still stand: dealing
with static type objects will be tricky.

Of course, I would also like to eliminate static type objects as much
as possible.

This then leaves the issue with the casts, which might be considered clutter.

Regards,
Martin


_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


martin at v

May 6, 2012, 11:27 PM

Post #10 of 11 (163 views)
Permalink
Re: Does trunk still support any compilers that *don't* allow declaring variables after code? [In reply to]

On 02.05.2012 15:37, Matt Joiner wrote:
>
> On May 2, 2012 6:00 PM, "Antoine Pitrou" <solipsis [at] pitrou
> <mailto:solipsis [at] pitrou>> wrote:
> >
> > On Wed, 02 May 2012 01:43:32 -0700
> > Larry Hastings <larry [at] hastings <mailto:larry [at] hastings>> wrote:
> > >
> > > I realize we can't jump to C99 because of A Certain Compiler. (Its
> name
> > > rhymes with Bike Row Soft Frizz You All See Muss Muss.) But even that
> > > compiler added this extension in the early 90s.
> > >
> > > Do we officially support any C compilers that *don't* permit
> > > "intermingled variable declarations and code"? Do we *unofficially*
> > > support any? And if we do, what do we gain?
> >
> > Well, there's this one called MSVC, which we support quite officially.
>
> Not sure if comic genius or can't rhyme.

This rhyming non-sense is surely above the English abilities of many of
us foreigners. I had to read Larry's text five times (two times after
you indicated that it indeed ought to rhyme - it finally worked when
I read it aloud).

So, folks: if you want to be understood, please keep the obfuscation
of the English language to a fairly low level.

Regards,
Martin
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


martin at v

May 6, 2012, 11:29 PM

Post #11 of 11 (165 views)
Permalink
Re: Does trunk still support any compilers that *don't* allow declaring variables after code? [In reply to]

> I realize we can't jump to C99 because of A Certain Compiler. (Its name
> rhymes with Bike Row Soft Frizz You All See Muss Muss.) But even that
> compiler added this extension in the early 90s.


No, it didn't. The MSVC version that we currently use (VS 2008) still
doesn't support it.

Regards,
Martin
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com

Python dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.