Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

What are inline functions in C and how could it be used?

Status
Not open for further replies.

agg_mayur

Member level 3
Joined
Feb 25, 2010
Messages
66
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,288
Location
India
Activity points
1,715
Hi All,
Please tell me what are inline functions in C language and they boost up the spped of code?
If i declare a macro like this:
#define SUM a+b
then what will be the type of 'a' and 'b'? How compiler judge the data type of variables written in Macro.
Can i declare the variables as int,float, etc... in macro definition.
 

Hello!

Hi All,
Please tell me what are inline functions in C language and they boost up the spped of code?

First, inline functions.. The compiler will insert the body of this function at every place the function is used, which saves the time required execute a function call.

If i declare a macro like this:
#define SUM a+b
then what will be the type of 'a' and 'b'? How compiler judge the data type of variables written in Macro.
Can i declare the variables as int,float, etc... in macro definition.

You can't declare as int, float etc in a macro. And the compiler doesn't judge anything, it will just paste a and b into the macro which will be the type of that variable being pasted. Macro is dangerous to use sometimes just because of that, can have unexpected results.

Regards

/ Morgan
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top