Click here to Skip to main content
15,887,350 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: how the macro works [modified] Pin
toxcct12-Dec-07 0:50
toxcct12-Dec-07 0:50 
GeneralRe: how the macro works Pin
George_George12-Dec-07 0:59
George_George12-Dec-07 0:59 
GeneralRe: how the macro works Pin
toxcct12-Dec-07 2:01
toxcct12-Dec-07 2:01 
JokeRe: how the macro works Pin
Cedric Moonen12-Dec-07 2:10
Cedric Moonen12-Dec-07 2:10 
JokeRe: how the macro works Pin
toxcct12-Dec-07 2:13
toxcct12-Dec-07 2:13 
GeneralRe: how the macro works Pin
George_George12-Dec-07 2:35
George_George12-Dec-07 2:35 
GeneralRe: how the macro works Pin
toxcct12-Dec-07 2:38
toxcct12-Dec-07 2:38 
AnswerRe: how the macro works Pin
Iain Clarke, Warrior Programmer12-Dec-07 1:42
Iain Clarke, Warrior Programmer12-Dec-07 1:42 
This is an odd macro, but I presume it makes more sense in the context you're copying it from. (after all, if you wrote it yourself, you'd know what it does.

It may make more sense if main was like this

main ()
{
   int q = GETFOO;
   return 0;
}

instead.

That is expanded to...
int q = Foo(&counter), counter;


So, the function Foo is called, does it's magic, and places a result into counter.
Then the second half of the right hand expression is called, which is simply counter, so counter is then placed into q.

It's equivalent to:
int q;
Foo (&counter);
q = counter;


The comma operator is a bit odd and will take some reading.

The main place I see it is in for loops:
for (a = 0, b = 7; a < 9; a++, b++)
{
   ...
}


while allows you to combine a bunch of expressions between the ;'s.

I hope that makes some sense.

While you're asking us all the horrible questions in C, I can't recommend strongly enough The C Programming Language[^] by Kernighan & Ritchie.

Iain.
GeneralRe: how the macro works Pin
CPallini12-Dec-07 1:59
mveCPallini12-Dec-07 1:59 
GeneralRe: how the macro works Pin
George_George12-Dec-07 2:00
George_George12-Dec-07 2:00 
GeneralRe: how the macro works Pin
toxcct12-Dec-07 2:09
toxcct12-Dec-07 2:09 
GeneralRe: how the macro works Pin
George_George12-Dec-07 2:18
George_George12-Dec-07 2:18 
GeneralRe: how the macro works Pin
toxcct12-Dec-07 2:21
toxcct12-Dec-07 2:21 
GeneralRe: how the macro works Pin
Cedric Moonen12-Dec-07 2:24
Cedric Moonen12-Dec-07 2:24 
GeneralRe: how the macro works Pin
toxcct12-Dec-07 2:27
toxcct12-Dec-07 2:27 
JokeRe: how the macro works Pin
CPallini12-Dec-07 2:58
mveCPallini12-Dec-07 2:58 
GeneralRe: how the macro works Pin
CPallini12-Dec-07 2:36
mveCPallini12-Dec-07 2:36 
GeneralRe: how the macro works Pin
Iain Clarke, Warrior Programmer12-Dec-07 2:48
Iain Clarke, Warrior Programmer12-Dec-07 2:48 
GeneralRe: how the macro works Pin
George_George12-Dec-07 1:59
George_George12-Dec-07 1:59 
GeneralRe: how the macro works PinPopular
Nelek12-Dec-07 2:56
protectorNelek12-Dec-07 2:56 
GeneralRe: how the macro works Pin
toxcct12-Dec-07 3:01
toxcct12-Dec-07 3:01 
GeneralRe: how the macro works Pin
Iain Clarke, Warrior Programmer12-Dec-07 2:57
Iain Clarke, Warrior Programmer12-Dec-07 2:57 
AnswerRe: how the macro works Pin
David Crow13-Dec-07 4:57
David Crow13-Dec-07 4:57 
GeneralRe: how the macro works Pin
George_George13-Dec-07 22:43
George_George13-Dec-07 22:43 
GeneralShell_NotifyIcon sends which messages to the traybar, I'd like to hook it. Pin
followait11-Dec-07 23:27
followait11-Dec-07 23:27 

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.