if flag 0x5c is met, return trueCode:static void sramDbgParse(void) { if (SRCopy.flag == 0x5c) { printf("\r\nWatchdog flag seen. Prev pc/lr/prc_cur: "); printf(Copy.last_pc); printf(Copy.last_lr); printf(Copy.last_prc); printf("\r\n"); } }
if flag 0x5c is met, return trueCode:static void sramDbgParse(void) { if (SRCopy.flag == 0x5c) { printf("\r\nWatchdog flag seen. Prev pc/lr/prc_cur: "); printf(Copy.last_pc); printf(Copy.last_lr); printf(Copy.last_prc); printf("\r\n"); } }
.. is that a question?
edit - I'm just going to say this before this thread turns into the same thing as your first thread: Give us all the details of what you're trying to do, and then ask a very specific question.
And more specifically, how do you propose to return anything from a void function with a void parameter list?
> .. is that a question?
if this is an answer
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Judging by the global variable that's in there, my best bet is they just need to add this line to the end and change the return type:how do you propose to return anything from a void function with a void parameter list?
Code:return SRCopy.flag == 0x5c;
my question is valid as in:
- the function above is called by in another module and works fine so, don't get all caught up with that.
Question was:
-- write a new function that would check the validity of 0x5C and return true if it's flagged as set or not set
if it's set the I would use the new return function to log a counter in memory
hope that is clear
So then do that. What's the problem? (After all, if you've got C99, you've got "true" and "false" already.)
You already check if that's set... why don't you just return the outcome of that expression? It seriously can't be any simpler...