![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| in vim how can i view the macro | lakshmananindia | UNIX for Advanced & Expert Users | 2 | 10-25-2007 06:25 AM |
| Regarding #ident macro | sarwan | High Level Programming | 1 | 10-06-2006 04:17 AM |
| USRSTACK macro | jalburger | HP-UX | 1 | 12-03-2004 04:58 PM |
| VI Macro Problem | Atama | UNIX for Dummies Questions & Answers | 1 | 05-16-2002 12:13 PM |
| macro on shell script ? | inquirer | UNIX for Dummies Questions & Answers | 4 | 08-15-2001 10:31 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
yes you can,
but i dont think there could be any such necessity for the same, in case of function definition it is going to be one time and why do u need to have a macro for that, macros are meant for substitution where u need to have many. Code:
# include <stdio.h>
void fun();
# define ab void fun() { printf("fun\n"); }
int main()
{
(void) fun();
return 0;
}
ab
|
|
||||
|
i am afraid I didnt get your point exactly,
did u mean, popping and pushing function address and re-iterating program counter in stack trace ? if that is so, then having a macro will not have any effect on the above, as macro substitution would take place at the pre-compilation stage itself, then goes compilation, linking, executing. No way the time counters represented above would have an effect If I had understood wrongly, please get me the correct point. Thanks. |
|
||||
|
no
actually,
instead of calling a function we want a macro to do the job. i.e can we have a function in the form of a macro. e.g #define fun(args....) /*code for macro */ /*about 10 loc */ main() { .... .... .... fun(....); .... } |
|
||||
|
then in such case,
make use of inline functions they get expanded in pre-compilation itself similiar to macros. But make sure that the function quoted as inline should not be a heavy-loaded which would drastically bring down the performance of the program. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|