AnsweredAssumed Answered

Compiler Warning i.e. "Expression has no side effect" in .c file.

Question asked by Mahamed Yusoof M on Aug 17, 2018

Compiler is generating a warning in .c when an API SetQuizBuckUFalt is called. The warning says expression has no side effect which means "statement does not change the program’s state", however the functionality is working fine for us but we need to understand why compiler is throwing a warning..?


### mwcceppc.exe Compiler:
#    File: ..\CHCM1P25\source\ostaskapi.c
# ---------------------------------------
#     506:       SetQuizBuckUFalt(SET_VAL); 
# Warning:                                ^
#   expression has no side effect


Compiler used: Freescale code warrior 2.10

Micro Controller: SPC564A80B4


Function definition:


uint8 VBuckFaltFlg;


/* The macro sets the VBuck fault flag to indicate the VBuck fault */

#define SetQuizBuckUFalt(SetValue) \
( (SetValue == SET_VAL)? (VBuckFaltFlg = SET_VAL):(VBuckFaltFlg = CLEAR_VAL) )