Re: Using functions for MAX and MIN limitsthierusability.

From: Peter Ajamian (
Date: 04/21/01

George Greer wrote:
> On Sat, 21 Apr 2001, Peter Ajamian wrote:
> Between subtle run-time failure and compiler warning, I'll take the latter.
> You can at least tolerate a SMAX/UMAX combination for cases where it
> matters.  Clean? Not really, but better than confusing yourself with extra
> side-effects, especially since 'b++' is only a trivial example.

Right, I quite agree, at least in the context of how CircleMUD is used.
I didn't see the problem in your b++ example until Tony pointed it out
(another example where C++-style templates would have been nice).

Would it not be better if it were passed and returned a long, though so
that it would be compatible with longs on 16 bit platforms?  Or maybe
compilers would complain too much about the implicit conversion from long
to something less than long on the return?

Take that one step further and maybe even test for implementations that
have a long long type (it won't be very long until all have long long
types since C99 supports long long anyways).

Just a couple more thoughts on the matter,

Regards, Peter

   | FAQ: |
   | Archives: |

This archive was generated by hypermail 2b30 : 12/05/01 PST