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.

How the C code will Execute

Status
Not open for further replies.

em_begin

Newbie level 2
Joined
Feb 11, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,302
hiii

plz explain me the flow of code;
specially ifdef,endif,
int *cmd;
void Parse_Command(void)
{
char* pointer;
int i, j;

pointer = CommandString;
err = ERR_SUCCESS;
command = CMD_UNDEFINED;

#ifdef _ECHO_
SerSendStr(CommandString);
#endif

// Get the command
cmd = pointer;
.
.
.....................(some other code)
}

how the xecution will happen here.

thnx,
 

hi

first i would like to ask you whether you know a little about C
because if you know some basics it will be easy to explain
if not,it will be difficult and will take more time
if you know pointer then almost all part is already explained.
now ifdef
at the beginning if _ECHO_ was defined as true, the line"SerSendStr(CommandString);" will get executed, otherwise the copiler skips that line until endif, because the endif statement is the end of ifdef.
simply if _ECHO_ is defined SerSendStr(CommandString); else go to the next line after endif.

is that alright?

ml
 

Conditionally includes a set of commands at compile time if a compile-time constant is defined.

#IFDEF | #IFNDEF ConstantName
Commands
[#ELSE
Commands]
#ENDIF

Parameters
#IFDEF
Specifies that a set of commands is included at compile time when the ConstantName is defined.

The following items describe how a set of commands is included at compile time when you include #IFDEF:

If ConstantName is defined, the set of commands following #IFDEF and preceding #ELSE or #ENDIF (whichever occurs first) is included at compile time.

If ConstantName is not defined and #ELSE is included, the set of commands following #ELSE and preceding #ENDIF is included at compile time.

If ConstantName is not defined and #ELSE is not included, no commands within the #IFDEF ... #ENDIF structure are included at compile time.

#IFNDEF
Specifies that a set of commands is included at compile time when the ConstantName is not defined.

The following items describe how a set of commands is included at compile time when you include #IFNDEF:

If ConstantName is not defined, the set of commands following #IFNDEF and preceding #ELSE or #ENDIF (whichever occurs first) is included at compile time.

If ConstantName is defined and #ELSE is included, the set of commands following #ELSE and preceding #ENDIF is included at compile time.

If ConstantName is defined and #ELSE is not included, no commands within the #IFNDEF ... #ENDIF structure are included at compile time.

ConstantName
Specifies the compile-time constant whose existence determines whether a set of commands is included at compile time. Compile-time constants are defined with #DEFINE.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top