Please enable JavaScript to view this site.

 

This macro compiler warning occurs if you declare a variable in the input section of a macro, but then assign a value to it in the body of the macro, before the input value is ever used.

input
    nNewDate
var
begin    
    nNewDate = n_TokenDate + 5 // input value of nNewDate is ignored !!
    if WeekdayOf(nNewDate) <> 7
        sRESULT = 'Monday to Saturday'
    else
        sRESULT = 'Sunday'
    endif
end

This message is classified as a warning, even though it is fundamentally similar to the message that the value assigned to a variable is never used, which is only a hint.

 

The reason is that the present message usually comes from modifying a macro that did not use input values to a macro that uses input values, and forgetting to remove the initialization of the variable that has become an input variable.

 

These are extremely hard errors to find because you are so used to seeing the initialization code (line nNewDate = n_TokenDate + 5 in this case) that when your macro does not give the expected results, you search everywhere else but in that line, for the cause of the problem.

 


Topic 109904, last updated on 18-Apr-2020