[comp.os.minix] 65535 is a good number

meulenbr@cstw68.prl.philips.nl (Frans Meulenbroeks) (11/09/89)

In article <4464@ast.cs.vu.nl> ast@cs.vu.nl (Andy Tanenbaum) writes:
>
>I checked the C draft standard, and UINT_MAX is just a number, not a
>qualified type.  Thus a cast is incorrect.  It really should be just the
>number 65535.  If you are passing it as a parameter to a routine expecting
>an unsigned int, you must put a cast in the call.
>
>If I were to put the cast in the definition of UINT_MAX and you were not
>to use a cast, your code would not be portable to systems where they
>defined it without a cast (which is to be expected everywhere).
>
>Sorry, Terrence, but I don't think I have any choice.  Compared to all
>those places where you are going to need a cast for NULL, this is small
>potatoes.
>
>
>Andy Tanenbaum (ast@cs.vu.nl)

Ok. This triggered me enough to search some more in my oct 31, 1988 ANSI
draft.
In sec. 2.2.4.2 (Numerical limits), p 14 of the oct draft it says:
--- start of quote ---
Size of integral types <limits.h>

The values given below shall be replaced by constant expressions
suitable for use in #if preprocessing directives. Moreover, expect for
CHAR_BIT and MB_LEN_MAX, the following shall be replaced by expressions
that have the same type as would an expression that is an object of the
corresponding type converted according to the integral promotions. Their
implementation defined values shall be equal or greater in magnitude
(absolute value) to those shown, with the same sign.
--- end of quote ---

Note that linebreaks are on different places in the draft.
The text starting with preprocessing ... object spans two lines which are
marked with a +, implying an addendum. You will find a different wording
in previous drafts.

The line with Moreover suggest to me that a cast would be appropriate,
but of course english is not my native language, and this sentence is a
little more complex than "Mary had a little lamb".

By the way: Posix P1003.1 specifies on page 26 that until X3J11 is
available, posix refers to the may 88 draft.

Frans Meulenbroeks        (meulenbr@cst.prl.philips.nl)
	Centre for Software Technology
	( or try: ...!mcvax!phigate!prle!cst!meulenbr)