Please enable JavaScript to view this site.

 

Navigation: Macros > Macro Language > Compiler Messages > Hints

Function is defined but never used

Scroll Prev Up Next More

This compiler hint will occur if one of the user-defined functions at the top of your macro is never used in the macro's main body.

 

For example, you might originally have added a function to a macro to get the name of the current Zodiac sign as in the example below.

function ZodiacNameOfDate(nSomeDate): s
var
   nIndex sBuffer
begin
   nIndex = MoonZodiacSignOf(nSomeDate,0,true,1)
   sBuffer = ZodiacName(nIndex)
   return sBuffer
end
 
var
   nZodiacIndex
begin
   // the call to the user function ZodiacNameOfDate
   // was replaced by calls to the built-in functions
   // and the user-defined function is no longer needed
   nZodiacIndex = ZodiacSignOf(n_TokenDate, 1, true)
   sResult = ZodiacName(nZodiacIndex)
end

But, then, later, you found out that there were built-in macro functions that could do the same thing and you decided to use them instead of your own function, which is no longer used/needed, as this hint informs you of.

 

Note that the macro compiler only tries to compile the code of functions that are used. Therefore, no errors will be issued for the code of an unused function.

 


Topic 181005, last updated on 02-Dec-2024