Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 C++ Macroses in C#

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
Gastello Posted - Jul 10 2009 : 08:15:05 AM
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.
1   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jul 11 2009 : 4:20:32 PM
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.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000