Click here to Skip to main content
15,893,190 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Make colord darker/grayer Pin
Jason Henderson31-Mar-03 4:23
Jason Henderson31-Mar-03 4:23 
GeneralRe: Make colord darker/grayer Pin
Brian van der Beek31-Mar-03 4:40
Brian van der Beek31-Mar-03 4:40 
GeneralRe: Make colord darker/grayer Pin
Maximilien31-Mar-03 4:16
Maximilien31-Mar-03 4:16 
GeneralAutomatic macro increment Pin
Jesper Knudsen31-Mar-03 2:05
Jesper Knudsen31-Mar-03 2:05 
GeneralRe: Automatic macro increment Pin
Cedric Moonen31-Mar-03 2:25
Cedric Moonen31-Mar-03 2:25 
GeneralRe: Automatic macro increment Pin
Jesper Knudsen31-Mar-03 2:40
Jesper Knudsen31-Mar-03 2:40 
GeneralRe: Automatic macro increment Pin
Daniel Turini31-Mar-03 7:54
Daniel Turini31-Mar-03 7:54 
GeneralRe: Automatic macro increment Pin
Alvaro Mendez31-Mar-03 5:44
Alvaro Mendez31-Mar-03 5:44 
I'm pretty sure there's a clever template solution to this problem, but from looking at your example, I'm thinking it doesn't need to be too complicated.

Going on the assumption that your variable will be named with the same value as it holds (such that VARn = n), then you can create a simple macro that defines it, like this:

#define DEFINE_INDEX_VAR(prefix, number)  const int prefix##number = number
 
void something()
{
  DEFINE_INDEX_VAR(A, 0);
  DEFINE_INDEX_VAR(A, 1);
...
  DEFINE_INDEX_VAR(Z, 1000);
}

Regards,
Alvaro



When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
Generalstatic control color Pin
Cedric Moonen31-Mar-03 1:20
Cedric Moonen31-Mar-03 1:20 
GeneralRe: static control color Pin
Alin Negru31-Mar-03 1:31
Alin Negru31-Mar-03 1:31 
GeneralRe: static control color Pin
Cedric Moonen31-Mar-03 2:18
Cedric Moonen31-Mar-03 2:18 
GeneralRe: static control color Pin
Gunnar Bolle31-Mar-03 2:40
Gunnar Bolle31-Mar-03 2:40 
GeneralRe: static control color Pin
Cedric Moonen31-Mar-03 2:54
Cedric Moonen31-Mar-03 2:54 
GeneralHelp about appending the latest data to another file. Pin
dxhdxh31-Mar-03 1:09
dxhdxh31-Mar-03 1:09 
GeneralWebBrowser control questions Pin
tinkywinky31-Mar-03 0:50
tinkywinky31-Mar-03 0:50 
GeneralRe: WebBrowser control questions Pin
Stephane Rodriguez.31-Mar-03 1:10
Stephane Rodriguez.31-Mar-03 1:10 
Generalgetting a file Pin
Jump_Around31-Mar-03 0:42
Jump_Around31-Mar-03 0:42 
GeneralRe: getting a file Pin
MarkusStr31-Mar-03 1:25
MarkusStr31-Mar-03 1:25 
QuestionMonitoring dialling - how? Pin
Mark Otway31-Mar-03 0:08
Mark Otway31-Mar-03 0:08 
AnswerRe: Monitoring dialling - how? Pin
Ted Ferenc31-Mar-03 4:11
Ted Ferenc31-Mar-03 4:11 
GeneralRe: Monitoring dialling - how? Pin
Mark Otway31-Mar-03 4:21
Mark Otway31-Mar-03 4:21 
Generalntddk.h problem Pin
vikramlinux30-Mar-03 23:57
vikramlinux30-Mar-03 23:57 
GeneralPrb with PreCreateWindow Pin
SatyaDY30-Mar-03 23:22
SatyaDY30-Mar-03 23:22 
GeneralRe: Prb with PreCreateWindow Pin
Cedric Moonen31-Mar-03 0:17
Cedric Moonen31-Mar-03 0:17 
GeneralRe: Prb with PreCreateWindow Pin
SatyaDY31-Mar-03 0:49
SatyaDY31-Mar-03 0:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.