BS> I was about to chastise you over two things
BS> Still, the issue remains in C++ that such a function
BS> *must* have a prototype and the prototype will be
BS> different depending on the type of the operand.
True. It would require a whole stable of sgn() functions.
Did I forget to mention that it is so trivial a bit of
code in C or C++ that you may as well just do it inline
and save yourself the function call? :)
It's not like in BASIC, where it would require several
lines of code, after all. The real problem arises when
you want to do a calculation within the conditional.
This, however, is a design problem easily surmounted
by the individual without the use of multiple functions.
Some older C++ compilers, such as Borland 3.1, do not
support templates, so that avenue, while available, is
not an overall solution either.
Personally, I would perform my calculations outside the
ternary conditional and use a simple inline statement.
If you KNEW that the macro required that the values not
be used with assignment operators, then that would be
a viable avenue as well, but, as you know, you can not
rely on the programmer to observe such a rule.
If *I* were writing the language, I believe that I would
simply not include a sgn() function at all! ;)
---
> ] I'm not materialistic. I'm just Object Oriented.............
---
---------------
* Origin: *YOPS ]I[* 3.1 GIG * RA/FD/FE RADist * Milwaukee, WI (1:154/750)
|