Re: Overcoming C# limitations

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Danny Liberty wrote:
2. In C++ I could have defined a macro to instantiate an object and
then make a method call. For example:
#define MY_FUNC(x) MyObj a; a.func(x);
This would have been useful since I could use this macro in any scope
knowing that the destructor of MyObj (or instance a) will be called at
the end of the scope without explictly calling any function. For
example:
void Foo()
{
MY_FUNC(3);
.... more code....
} <-- destructor of MyObj would be called here


um... You want to hid the call to the ctor, and then have significant
action in the dtor. Forgive me, but I'm really glad I don't have to
maintain your code....

.



Relevant Pages

  • Re: Overcoming C# limitations
    ... add an optional parameter to. ... This would have been useful since I could use this macro in any scope ... knowing that the destructor of MyObj will be called at ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Object destruction
    ... MyObject * myObj; ... myObject is destroyed when it goes out of scope in main. ... destructor (or, in a sense, it has a trivial destructor that does ...
    (microsoft.public.vc.language)
  • Overcoming C# limitations
    ... I've recently encountered some design problems due to the language ... This would have been useful since I could use this macro in any scope ... knowing that the destructor of MyObj will be called at ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Object destruction
    ... MyObject * myObj; ... myObject is destroyed when it goes out of scope in main. ... destructor (or, in a sense, it has a trivial destructor that does ...
    (microsoft.public.vc.language)
  • Re: Overcoming C# limitations
    ... This would have been useful since I could use this macro in any scope ... knowing that the destructor of MyObj will be called at ... public static void MyFunc ...
    (microsoft.public.dotnet.languages.csharp)