[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-dev] building from source in a 64-bit windows environment..



I don't think this conversation is going anywhere constructive, but I
wish to correct a factual error before I drop the subject.

> Really? where? It doesn't seem to be in the C89 standard I just flipped through.

You are quoting C99, not C89.  The thing we are arguing about was
changed in the 1999 revision.

The closest approximation to C89 that I can find online is
http://flash-gordon.me.uk/ansi.c.txt (this appears to be the text of
the 1998 ANSI standard for C that was adopted by ISO one year later,
extensively renumbered but with no substantive changes on the points
of dispute).  Please take note of the following differences from the
later standard:

* There is no [u]intptr_t.
* There is no such thing as an "extended integer type".  The only
"integral types" are [unsigned] char, [unsigned] short, [unsigned]
int, and [unsigned] long.
* size_t and ptrdiff_t are required to be "integral types", i.e. they
*cannot* be larger than [unsigned] long.
* Annex I does not exist. However, there is similar wording in section
3.3.4 (cast operators), stating that the result of converting any
pointer to an integer is implementation-defined and that "if the space
provided is not long enough, the behavior is undefined."

It is true that you will not find text anywhere in the 1989 standard
explicitly stating that void* is required to be interconvertible with
size_t (and therefore also with unsigned long) without loss of
information.  However, this point was debated extensively on
comp.std.c in the late 1990s, with WG14 members participating, and the
conclusion of that debate was that this *is* an implicit requirement
of the 1989 standard (provided the memory space is flat), although not
the 1999 standard.

The requirements of the older standard are still relevant precisely
because Microsoft never implemented the newer standard.  If they had,
Tor would be using <stdint.h> and uintptr_t and you would not have had
a problem in the first place.  But they didn't.  MSVC 2012 still
claims conformance with "ANSI C" and "ISO C95", not C99: see
http://msdn.microsoft.com/en-us/library/sk54f3f5.aspx  (The only
differences between C89 and C95 have to do with internationalization.)

zw
_______________________________________________
tor-dev mailing list
tor-dev@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev