One of the problems I often encounter with writing any OOP code is that I write something like:
Global objectVar:TList
Then forget to actually create the object using the New operator (either directly or via another function).
When you later call any list functions, this causes a somewhat bewildering "Unhandled Exception" error, which can be tricky to track down since the error often occurs in a completely different part of the code, or sometimes even a completely different module.
Compilers like GCC / VC++ would print a warning in equivilent code that objectVar has not been initalised.
Does anyone have any ways of dealing with this at the moment? Could any compiler features be implemented to protect me from my forgetfulness?
Global objectVar:TList
Then forget to actually create the object using the New operator (either directly or via another function).
When you later call any list functions, this causes a somewhat bewildering "Unhandled Exception" error, which can be tricky to track down since the error often occurs in a completely different part of the code, or sometimes even a completely different module.
Compilers like GCC / VC++ would print a warning in equivilent code that objectVar has not been initalised.
Does anyone have any ways of dealing with this at the moment? Could any compiler features be implemented to protect me from my forgetfulness?