Original Post
Ive been trying to write some c++ code that could easily be used in managed as well as unmanaged mode. However I stumble upon a problem being that managed code doesnt allow for plain variables (one has to use pointers). This poses a problem, since in managed mode doing if((b->Something(c))->check(d)); is no problem since the memory reserved by the first function call is garbage collected. For unmanaged code however one would often use non pointer variables hence not having to keep track of a pointer. The only portable way I see is to have a temporary variable MyClass *tmp = b->Something(c); and later freeing the memory. Having this often makes your code horribly ugly. Anybody have any ideas on portable code design? -CProgrammer