TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: BOB STOUT
from: KURT KUZBA
date: 1997-07-15 23:57:00
subject: Signs of numbers

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)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.