Redefinition



next up previous contents index
Next: Function Up: Predefined functions Previous: Strings

Redefinition

 

It is possible to redefine functions and global variables (in this case new definitions step over old ones) under certain conditions, essentially for debug reasons, but it is not possible to change function or global variable profiles. Thus, you cannot change a function return value type, nor its parameters number and their types, nor the type of a global variable (dimensions included). Neither is it possible to redefine an active function, or to redefine predefined functions.

remove_function_definition

   void remove_function_definition(void * pfunc)

The first way to redefine a function is to undefine it, and then to give it its new definition. After a remove\_function\_definition call, the function whose name is given as argument remains simply undeclared. However, it is not possible to undefine an active function (during its execution), nor to undefine a predefined function.

Obviously, this way is cumbersome when you want to redefine several functions, for instance when you want to reload a file. In this case you will probably prefer the following function:

debug_mode

   void debug_mode(int mode)

After a debug\_mode call with a non null argument, you can redefine your functions and global variables. If the argument is greater than 1, redefinitions are signaled by a warning. After debug\_mode call with zero as argument you cannot make redefinitions anymore.



Lionel Fournigault
Mon Mar 6 13:33:34 MET 1995