adspace


How are macros different from inline functions?

Answer Posted / Anuj Kumar Sharma

Macros and inline functions are both used to expand code at compile time, reducing the need for function calls. However, they have some key differences:n
1. Semantic issues: Macros can lead to semantic errors because their behavior is not checked by the compiler until expansion. Inline functions are compiled like regular functions and do not suffer from this issue.
2. Readability: Macros can make code less readable because they expand into unstructured blocks of text, making it harder to understand what's happening.
3. Maintenance: Macros can be more difficult to maintain than inline functions because changes in the macro definition can affect multiple places where the macro is used.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Are you still writing code? Do you love it?

864


Tell me about some of your hobby projects that you've written in your off time.

974


Would you call yourself a craftsman (craftsperson) and what does that word mean to you?

930


What software languages have you used to design, develop, and debug software application interfaces?

944


What is your experience with qa engineering?

928