We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Keil uVision 5
const MCANMessage ClientRespondSysCommand(BYTE byCommand, BYTE nLen, BYTE* pData) { MCANMessage NewMessage; InitMessage(&NewMessage); NewMessage.bServerSend = FALSE; NewMessage.byAddress = m_IOModuleCANAddr; NewMessage.CommType = Responder; NewMessage.ClientDeviceType = DEVICE_PHYSICAL; NewMessage.byCommParam = byCommand; NewMessage.MessageState = MESSAGE_WAIT_FOR_SEND; NewMessage.wDataLen = (nLen <= 7) ? nLen : 7; if (nLen != 0) NewMessage.pData = pData; SendMCANMessage(&NewMessage); return NewMessage; }
warning : type qualifier on return type is meaningless
So the const is not needed. Am i right?
Again, think about it: the return value from a function is inherently read-only - isn't it?