From: Vladimir Grigoriev on
It seems that min/max macros are not a part of the C standard. Does anybody
know the rationale of this?

Vladimir Grigoriev


From: Victor Bazarov on
Vladimir Grigoriev wrote:
> It seems that min/max macros are not a part of the C standard. Does anybody
> know the rationale of this?

I am *sure* somebody in 'comp.std.c' might know. It's even possible
that somebody in 'comp.lang.c' knows, too.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
From: Vladimir Grigoriev on

"Tim Roberts" <timr(a)probo.com> wrote in message
news:7uq4m5p6ulr3lphpu6g238udljfbavoenp(a)4ax.com...
> The original C89 committee focused on codifying existing practice rather
> than inventing new features. Perhaps there weren't enough existing
> compilers with min/max implementations.

It is strange enough because all old C compilers had usually min/max macros.
And it is funny that even now users using modern C compilers define min/max
macros yourself. It looks like a gap in the C standard because it does not
offer an alternative.

Vladimir Grigoriev




From: Ulrich Eckhardt on
Vladimir Grigoriev wrote:
> "Tim Roberts" <timr(a)probo.com> wrote in message
> news:7uq4m5p6ulr3lphpu6g238udljfbavoenp(a)4ax.com...
>> The original C89 committee focused on codifying existing practice rather
>> than inventing new features. Perhaps there weren't enough existing
>> compilers with min/max implementations.
>
> It is strange enough because all old C compilers had usually min/max
> macros. And it is funny that even now users using modern C compilers
> define min/max macros yourself. It looks like a gap in the C
> standard because it does not offer an alternative.

Some consider macros evil. I'd even consider those very macros evil because
they can break if the 'arguments' contain side effects. At least they
should be called MIN/MAX instead. Further it isn't hard to write similar
code using the ternary operator. Still, I'm aware that many people seem to
like the macro.

I guess there simply wasn't enough consent for their inclusion but strong
voices against.

Uli

--
C++ FAQ: http://parashift.com/c++-faq-lite

Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
From: Vladimir Grigoriev on
Ulrich, your position has no any reasonable base. In fact it looks the
following way. You say that macros (as it follows including min/max macros)
are evils. O.k., and what to do to find minimal/maximum values? You
answer: "To write these macros yourself!" Is not it very strange, is it? And
what do compiler producers do? They include these macros in their libraries!
Or they advise users to write these macros themselves.:)

Vladimir Grigoriev

.
"Ulrich Eckhardt" <eckhardt(a)satorlaser.com> wrote in message
news:qfgi37-f48.ln1(a)satorlaser.homedns.org...
> Vladimir Grigoriev wrote:
>> "Tim Roberts" <timr(a)probo.com> wrote in message
>> news:7uq4m5p6ulr3lphpu6g238udljfbavoenp(a)4ax.com...
>>> The original C89 committee focused on codifying existing practice rather
>>> than inventing new features. Perhaps there weren't enough existing
>>> compilers with min/max implementations.
>>
>> It is strange enough because all old C compilers had usually min/max
>> macros. And it is funny that even now users using modern C compilers
>> define min/max macros yourself. It looks like a gap in the C
>> standard because it does not offer an alternative.
>
> Some consider macros evil. I'd even consider those very macros evil
> because
> they can break if the 'arguments' contain side effects. At least they
> should be called MIN/MAX instead. Further it isn't hard to write similar
> code using the ternary operator. Still, I'm aware that many people seem to
> like the macro.
>
> I guess there simply wasn't enough consent for their inclusion but strong
> voices against.
>
> Uli
>
> --
> C++ FAQ: http://parashift.com/c++-faq-lite
>
> Sator Laser GmbH
> Geschaftsfuhrer: Thorsten Focking, Amtsgericht Hamburg HR B62 932