![]() |
Overloaded functions
In my header file, I have the following function prototypes:
Code:
int abs(int);Code:
int abs(int x) |
Re: Overloaded functions
If I'm not mistaken, overloadable functions was added in C++ and is not possible in C.
|
Re: Overloaded functions
Quote:
|
Re: Overloaded functions
Well for this example, you could easily just cast to int and use the same function. (You could cast to int in all cases, even when it already is an int, to maintain uniformity). I can't really think of any other way.
|
Re: Overloaded functions
IMHO, no one would ever want to work with floating point at all in an embedded system like this. It makes no sense.
JMHO... |
Re: Overloaded functions
The only thing I can think of is to use a macro
Code:
#define ABS(num) ( ((num) >= 0) ? (num) : (0 - (num)) )But I still wouldn't use floating point. |
| All times are GMT -5. The time now is 02:46. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi