 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
raghu Guest
|
Posted: Tue May 08, 2007 9:12 am Post subject: #defines |
|
|
Hello Everyone,
I am using macro functions in my project the code is
working correctly, But I have a doubt wheather the macro functions
creates a context switching as in the case of normal functions. For
example see the code below:
#define funct(dest, src) {\
for( i = 0; i< 10; i++ )\
dest += (src + i);\
}
main()
{
int i, k;
funct(k , 10);
printf(" %d", k);
}
In this case 'int i' was not declared in funct but it works. And if in
main() 'int i' was not declared and declared in funct defination also
it works. Is there any context switch happening.
Thanks in advance
Bye
Raghu |
|
| Back to top |
|
 |
Ian Collins Guest
|
Posted: Tue May 08, 2007 9:12 am Post subject: Re: #defines |
|
|
raghu wrote:
| Quote: | Hello Everyone,
I am using macro functions in my project the code is
working correctly, But I have a doubt wheather the macro functions
creates a context switching as in the case of normal functions. For
example see the code below:
Macros are simple text substitution. |
Functions DO NOT cause a context switch, I think you are getting your
terminology in a muddle.
--
Ian Collins. |
|
| Back to top |
|
 |
Powered by phpBB © 2001, 2006 phpBB Group
|