필터 지우기
필터 지우기

How to eliminate local variables that are set but not used in generated code?

조회 수: 1 (최근 30일)
Xiaojie Qiu
Xiaojie Qiu 2018년 10월 8일
댓글: John D'Errico 2018년 10월 8일
Hi everyone,
In generated code, there are some variables that are defined but never used. After compilation, the IDE displays warnings because of them.
For example, in generated code below, a local variable named u16_OffsetAddress is defined and assigned, but not used. After compilation, I get a warning from the IDE indicating that this variable is set but not used.
// Code begin
static void my_model_EEPROMEraseBlock_Init(DW_EEPROMEraseBlock_simulink_function_T *localDW)
{
uint16_T u16_OffsetAddress;
localDW->s16_ErrorFlag_Temp = 0;
localDW->s16_ErrorFlag_out = 0;
u16_OffsetAddress = 0U;
}
// Code end
I want to know how to eliminate this kind of local variables or how to configurate simulink model in order to solve this problem? Thanks!
  댓글 수: 1
John D'Errico
John D'Errico 2018년 10월 8일
But why is it a problem? After all, computers don't really care. The warning is there, but it is just a warning.

댓글을 달려면 로그인하십시오.

답변 (0개)

제품


릴리스

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by