Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 C++ Macroses in C#
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Gastello
New Member

Germany
2 Posts

Posted - Jul 10 2009 :  08:15:05 AM  Show Profile  Reply with Quote
I would like to have simplification of my code, as in example on C++


#define MACR( a )\{\   if ( a == NULL )\   {\      ASSERT( false );\      return NULL;\   }\}

#define MACR2( a )\{\   if ( !(a) )\   {\      ASSERT( false );\      return NULL;\   }\}

int* SomeFunc()
{
      bool* pArray = new bool[ 1000 ];
      MACR( pArray );
      MACR2( SomeFunc2() );
}

bool SomeFunc2()
{
      //some code
      If ( some error condition )
            return false;
      //G?.. some code
      return true;
}


This will make error check of memory allocation and return values of functions very easy and comfortable in C#.
If there is no way to have this functionality in C#, may it would be wonderful to have macroses in C#.
Could you please implement some kind of preproceccor for C# files which will make preprocessing of C++ macroses in "*.cs" files and then will start C# compilator of Visual Studio.

Edited by - Gastello on Jul 10 2009 08:15:38 AM

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Jul 11 2009 :  4:20:32 PM  Show Profile  Reply with Quote
There is no chance of us trying to get involved in how C# code is compiled.

I don't know enough about C# to suggest the best way of doing this, but I suspect some form of exception handling might help, since I would expect exceptions to be thrown if / when null items are encountered.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000