One of the few things I do not do often (knowingly at least) is manipulate pointers. So I have to ask if I have a fatal flaw with a thought I had.
If I do not use a Global, but instead a function to Set or Get a value and then locally have that value, would the following be valid?
If I change something in the value passed, do I need to change the pointer? aka update ValueToSet to VarPtr(Variable), or am I just "Lucking Out" that I have not run into a problem yet?
If I do not use a Global, but instead a function to Set or Get a value and then locally have that value, would the following be valid?
Code:
FUNCTION SetGetLogErrors(ValueToSet AS LONG, ValueResults AS LONG, ResetValue AS LONG) AS LONG STATIC FunctionValue AS LONG 'Static to hold current value SELECT CASE ResetValue 'Decide whether to Set or to Get the current value CASE %False, %UNKNOWN_VALUE 'If set to False, or -1 Then Get Current Value ValueResults = FunctionValue 'Return Results as a parameter CASE = %TRUE 'If set to True then Reset the Current Value FunctionValue = ValueToSet 'Reset the value ValueResults = FunctionValue 'Return Results as a parameter END SELECT FUNCTION = %False 'Return if Function Failed END FUNCTION
Comment