Re: C89, size_t, and long



Eric Sosman wrote:
Yevgen Muntyan wrote On 03/14/07 15:14,:
Eric Sosman wrote:

Yevgen Muntyan wrote On 03/14/07 14:26,:
[...]
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). [...]
I don't know MS' Win64 implementation well enough to comment
on whether it's broken or not.
It has 32-bit long, same as int, and naturally 64-bit size_t.

If size_t is wider than long, the implementation cannot
conform to C89. It could, however, conform to C99, with
size_t being as wide as long long or as some other wide type.
One of the (many) things I don't know about MS Win64 is what
standards it claims to conform to.

It claims conformance to C90. It does not conform to C99.

....
[...] Anyway, is MS Win64 implementation not
C89-conforming (it's an important thing, isn't it)? Or I do miss
something?

From your description, it cannot be a conforming C89
implementation. Is that important? Well, to whom?

Well, to people who want to write code which would work on win64.

Yevgen
.



Relevant Pages

  • Re: C Strings
    ... sizeof ... More generally, given any array object, we can find a pointer to ... works quite as well for C99 as it did for C89, ...
    (comp.lang.c)
  • Re: Portability regarding sizeof() function
    ... Richard Heathfield wrote: ... Inappropriate use of sizeof can be dangerous, ... I think Richard H has the offical ANSI C89 standard, ... In fact, I cited the C99 spec too, and gave the relevant section number - just to show that the rules have *not* changed in C99. ...
    (comp.lang.c)
  • Re: C89, size_t, and long
    ... Was it required by C89 that result of sizeoffits into unsigned long, ... and that pointer subtraction result fits into long? ... Win64 implementation is not C89-conforming (while sizeof case may be ... It could, however, conform to C99, with ...
    (comp.lang.c)
  • Re: asking a question about pointer array.
    ... Flash Gordon said: ... It uses %p to print the result of sizeof which is wrong. ... For C89 it ... rjh at the above domain, ...
    (comp.lang.c)
  • Re: Macro constants
    ... Ioannis Vranos writes: ... In preprocessor arithmetic in C89, ... fits in a long. ... C89 compilers which support long long as an extension (except I'm not ...
    (comp.lang.c)