C89, size_t, and long
- From: Yevgen Muntyan <muntyan.removethis@xxxxxxxx>
- Date: Wed, 14 Mar 2007 18:26:50 GMT
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
.
- Follow-Ups:
- Re: C89, size_t, and long
- From: Jack Klein
- Re: C89, size_t, and long
- From: Eric Sosman
- Re: C89, size_t, and long
- Prev by Date: Re: What is C suitable for nowadays?
- Next by Date: Re: ANDing char and int data items
- Previous by thread: printf("%d", INT_MAX);
- Next by thread: Re: C89, size_t, and long
- Index(es):
Relevant Pages
|