There was a time when I was a C/C++ zealot, scoffing at those using anything else. A little while before .NET rolled out, I finally grasped the concept of “cost effective development“ and transitioned into being a VB advocate. One thing I've always missed in both VB and C#, however, was the ability to define macros. After looking at this, I don't know if I'll admit that any more  ...

#define FROMBUFFERTO_INT_VARIABLE(x) 
   lStatus = _OK;\
   pszLocal = strrchr(pszBuffer, '=');\
   pszLocal = (pszLocal == NULL) ? pszBuffer : pszLocal + 1;\
   ProcessString(pszLocal);\
   int i = atoi(pszLocal);\
   x = static_cast <short>(i);\
   return lStatus;\

#define  FROMBUFFERTO_BYTE_VARIABLE(x) 
   lStatus = _OK;\
   pszLocal = strrchr(pszBuffer, '=');\
   pszLocal = (pszLocal == NULL) ? pszBuffer : pszLocal + 1;\
   ProcessString(pszLocal);\
   int i = atoi(pszLocal);\
   x = static_cast <BYTE>(i);\
   return lStatus;\

#define ASSINGN_CHAR_DATA(x, y)
   if((y) != NULL)\
   {\
     DELETEMEMORY(x)\
     x = new char[strlen(y)+1];\
     if( x == NULL )\
     {\
       lStatus = _ERROR_MEMORY_ALLOCATION;\
       return lStatus;\
     }\
     strcpy(x, (y));\
   }\

// and later in the code

char *pszLocal = NULL;  // used by  FROMBUFFERTO_* macros, don't rename

 

 

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!