To avoid flames, if I try to reply a cannot find a 'post' nor 'preview' button, so I must start a new message thread. Sorry for the inconvinience. Dear KEIL Support Team, can you solve the problem with posting ? ---------------------------------------- It simply sets the all MInfo.'values' to a defined status, that is right. It was probably used with the intention to preset more than one variable of type MfCmdInfo. Example:
MfCmdInfo MInfo, MSecondInfo, MAnotherInfo; ResetInfo(MInfo); ResetInfo(MSecondInfo); ResetInfo(MAnotherInfo); will result in: MInfo.cmd=0 MInfo.status=MI_OK; ..... MSecondInfo.cmd=0; MSecondInfo.status=MI_OK; ..... MAnotherInfo.cmd=0; MAnotherInfo.status=MI_OK; .....
"Which begs the question: why use a macro rather than a true function, or memset?" To use a function, you'd have to pass a pointer to the structure; maybe the original author didn't understand how to use structure pointers? Or maybe he was worried about efficiency - in which case memset would have been better.