TechniqueUse one of the custom macros, or access the special return_value structure to add your value. Returning a string:
Returning a long:
Returning a double:
CommentsThe preceding are the different ways to return a string, a long, and a double. Note that when returning strings, the syntax (not the definition) of the macro is as follows : RETURN_STRING(char *str, int duplicate); The parameter duplicate should always be set to 1 , except in some extremely rare cases. The second approach to returning a string is the same as the macro way; in fact, the RETURN_STRING() macro is basically identical to the code given in the second approach. The RETURN_STRINGL() macro should be used when you want to specify the string length to return. Its syntax (again, not its definition) is the following: RETURN_STRINGL(char *str, int len, int duplicate); If you want to return true or false, use the RETURN_TRUE and RETURN_FALSE definitions (self explanatory). If you want to return null, use either an empty return or the RETURN_NULL() macro. |