On Sat, 22 Nov 2025, Alejandro Colomar wrote:

> @@ -10528,9 +10529,12 @@ c_parser_cast_expression (c_parser *parser, struct 
> c_expr *after)
>       _Countof ( type-name )
>       sizeof unary-expression
>       sizeof ( type-name )
> +     _Maxof ( type-name )
> +     _Minof ( type-name )
>       static-assert-declaration-no-semi
>  
> -   (_Countof and the use of static assertions in expressions are new in C2y.)
> +   (_Countof, _Maxof, _Minof, and the use of static assertions in
> +   expressions are new in C2y.)

This comment isn't currently accurate, given the status of these operators 
as an extension.

> +/* Return the result of minof applied to T, a structure for the type
> +   name passed to minof (rather than the type itself).  LOC is the
> +   location of the original expression.  */
> +
> +struct c_expr
> +c_expr_minof_type (location_t loc, struct c_type_name *t)
> +{
> +  tree type;
> +  struct c_expr ret;
> +  tree type_expr = NULL_TREE;
> +  bool type_expr_const = true;
> +  type = groktypename (t, &type_expr, &type_expr_const);
> +  ret.value = c_minof_type (loc, type);
> +  c_last_sizeof_arg = type;
> +  c_last_sizeof_loc = loc;
> +  ret.original_code = MAXOF_EXPR;

I think you mean MINOF_EXPR here.

> +@node _Maxof and _Minof
> +@subsection The maximum and minimum representable values of a type
> +@findex _Maxof
> +@findex _Minof
> +
> +The keywords @code{_Maxof} and @code{_Minof} determine
> +the maximum and minimum representable values of an integer type.
> +Its syntax is similar to @code{sizeof}.

"Its syntax" (singular) doesn't agree in number with "keywords" (plural).  
Try "Their syntax".

> +The operand must be
> +a parenthesized integer type.
> +The result of this operator is an integer constant expression.

And then it's operators (plural).

> +For example:
> +
> +@smallexample
> +_Maxof (int);    // returns INT_MAX
> +_Minof (short);  // returns SHRT_MIN

Returns SHRT_MIN *in type short* if you want to be precise, though you 
don't explicitly say what the type is above.  (Whereas the <limits.h> 
macros are in a type subject to integer promotions, so SHRT_MIN has type 
int.)

-- 
Joseph S. Myers
[email protected]

Reply via email to