print statement and multithreading

Tim Peters tim_one at email.msn.com
Tue Aug 29 17:11:46 EDT 2000


[Paul Duffin, on ISO/ANSI]
> I understand that they need money in order to do the job and I
> appreciate that their job is very important, I am just questioning
> whether selling copies of standards is the best way to finance it. ...

Suggest you bring that up with them <0.7 wink>.

>> I'll repeat the link you skipped over; anyone intending to
>> write portable C who doesn't know this stuff may as well kill
>> themself before they kill the project they're contributing
>> to <0.9 wink>:

> I am not sure what 'stuff' you are referring to, the comp.lang.c archive,
> or "ANSI C".

To the repeated link I'll repeat here again, and to which the "I'll repeat
the link" and the trailing colon were meant to lead you toward <wink>:

>>>> An excellent free overview can be found at:
>>>>
>>>>      http://www-ccs.ucsd.edu/c/

As to all the rest of this, I've really lost track of what you're trying to
accomplish.  If you're concerned about writing portable C, start by
*FOLLOWING THE LINK* above (was that subtle enough?).  Also read the C FAQ.
This is a Python newsgroup.

> ...
> The ANSI standard does define what a compliant compiler has to do but is
> there any way that I can check whether the compiler I have is compliant ?
> Is there a reference implementation, or is there a test suite which I
> can run against my compiler to determine whether or not it is compliant ?

C FAQ.  You can buy various conformance-testing suites, but few people other
than compiler vendors or giant corporations do that.  They're expensive.

> One problem with trying to write portable code is that while my compiler
> may be compliant in the sense that given ANSI code it works as defined
> by the language it can also provide extra functionality which I can
> easily use by accident. Is there a compiler out there which is pure
> ANSI which I can use to verify that my code does not use any of these
> extra pieces of functionality.

C FAQ.  There are commercial packages you can buy, but again they're
expensive.  Checking for runtime conformance is very difficult, because some
of the "slack" in the ANSI std is there precisely because it's extremely
difficult for a compiler + runtime system to catch violations.  For example,
it's not legal to compare pointer values via "<" unless they're addresses
derived from the same structure; this can't be checked except by tagging
every address with its origin at runtime, and compiling "<" into funky code
to dig thru the tags.  Nevertheless, you can buy packages that do this.

In practice, use as many compilers as you can get your hands on, crank every
one of them up to the most pedantic warning level they have, and don't rest
until every line gets compiled by every compiler without comment.  That's a
good "free" start.

> ...
> I think that it is a *very bold* step for Python to require an ANSI
> compliant compiler;

Clearly, we don't.  Most Python developers believed it was *long* overdue.
We have no problems at all with gcc or Microsoft's compiler or whatever the
heck it is Jack Jansen uses for Mac Python, and haven't for years, and that
easily covers 90+% of the market right there.

> ...
> Maybe you could consider setting up a few web pages which describe your
> experiences; it would be very useful for Python extension writers who
> will probably have to do a similar job and would appreciate any advice
> that you can give them,

Follow the link above.  Writing portable C is indepenent of Python; the same
concerns apply no matter what project C's being used in.  I believe Netscape
wrote up a bunch of portability gotchas too.  The Harbison & Steele book is
also an excellent reference.  Probably the worst trap awaiting people who
think "they're done" is that Win64 has sizeof(long) < sizeof(void*).  That
sure took Python by surprise, and Trent Mick (of ActiveState) did a lot of
tedious work to recover from it.

less-talk-more-code-ly y'rs  - tim






More information about the Python-list mailing list