Re: C89, size_t, and long



On Wed, 14 Mar 2007 18:26:50 GMT, Yevgen Muntyan
<muntyan.removethis@xxxxxxxx> wrote in comp.lang.c:

Hey,

I was reading C99 Rationale, and it has the following two QUIET CHANGE
paragraphs:

6.5.3.4: "With the introduction of the long long and extended integer
types, the sizeof operator may yield a value that exceeds the range
of an unsigned long."

6.5.6: "With the introduction of the long long and extended integer
types, the subtraction of pointers may return a value that exceeds the
range of a long."

Was it required by C89 that result of sizeof() fits into unsigned long,
and that pointer subtraction result fits into long? If yes, then MS
Win64 implementation is not C89-conforming (while sizeof case may be
arguable, I guess, we certainly can ask to malloc more than ULONG_MAX
bytes, and get pointer arithmetics which needs more than (unsigned)
long). If no, why these two paragraphs, if programs which relied on long
being big enough were already broken?

Yevgen

What do you mean by "already broken"? Neither 64-bit Windows, nor the
AMD 64-bit extension to the x86 instruction set, existed before the
C99 standard.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
.



Relevant Pages

  • C89, size_t, and long
    ... "With the introduction of the long long and extended integer ... Was it required by C89 that result of sizeof() fits into unsigned long, ... and get pointer arithmetics which needs more than ... If no, why these two paragraphs, if programs which relied on long ...
    (comp.lang.c)
  • RE: Value class initialization rules
    ... I found many paragraphs where the value types have a "this" pointer ... the value type its this pointer is a managed reference to the instance" ... error messages that a verifier can throw. ...
    (microsoft.public.dotnet.framework.clr)
  • Re: word 2000, multiple dashes
    ... Stan, it's a paragraph border. ... > i need a pointer for this problem. ... paragraphs at times, as i shift pages and paragraphs around. ...
    (microsoft.public.word.newusers)