more “bad style” programming
Using a global variable is a bad programming style, isn't it? But I've just used it, and I'm sure it's a right thing.
I have a set of recursive functions which use the same variable. Recursion may be quite deep, so use of the global variable saves stack space. It's good.
One of the functions is a callback function and accepts only one parameter "hint". Now this parameter is used to pass a pointer to an information block. If I didn't use the global variable, then I had to pass two parameters through the one parameter "hint". It means packing and unpacking of pointers, and so significant complication of a program. Compare it with the current simple code.
So, global variables sometimes very good.
The only thing bothers me. Will I have problems in multithreaded applications or not?