Click here to Skip to main content
16,012,611 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Exporting custom control via DLL Pin
_AnsHUMAN_ 29-Apr-07 18:28
_AnsHUMAN_ 29-Apr-07 18:28 
Questionlist control and selected records Pin
hero199529-Apr-07 17:22
hero199529-Apr-07 17:22 
AnswerRe: list control and selected records Pin
_AnsHUMAN_ 29-Apr-07 17:53
_AnsHUMAN_ 29-Apr-07 17:53 
Questionpreprocessor macro inside string literal? Pin
PJ Arends29-Apr-07 17:08
professionalPJ Arends29-Apr-07 17:08 
AnswerRe: preprocessor macro inside string literal? Pin
Stephen Hewitt29-Apr-07 18:30
Stephen Hewitt29-Apr-07 18:30 
GeneralRe: preprocessor macro inside string literal? Pin
PJ Arends29-Apr-07 21:04
professionalPJ Arends29-Apr-07 21:04 
GeneralRe: preprocessor macro inside string literal? [modified] Pin
cmk30-Apr-07 13:53
cmk30-Apr-07 13:53 
AnswerRe: preprocessor macro inside string literal? Pin
cmk30-Apr-07 14:17
cmk30-Apr-07 14:17 
An explanation to what Stephen posted.

What would be ideal would be:
#define  NUMBER    123
#define  ASSTR(X)  #X

But, when used in:
strcmp(SomeString, ASSTR(NUMBER));

We get:
strcmp(SomeString, "NUMBER");
because the token is converted _before_ it is checked for further macro expansion.

So we have to remove the expansion by one level (the boost example adds an extra 2 levels for some reason):
#define  NUMBER    123
#define  STR(X)    #X
#define  ASSTR(X)  STR(X)

Now we get:
strcmp(SomeString, "123");

This is because:
- first ASSTR(NUMBER) is replaced with STR(NUMBER)
- _then_ the macro is checked for further explansion and NUMBER is replaced with 123 _before_ STR() is resolved
- so we get STR(123) which gives "123".


...cmk

Save the whales - collect the whole set

GeneralRe: preprocessor macro inside string literal? Pin
PJ Arends1-May-07 5:20
professionalPJ Arends1-May-07 5:20 
GeneralRe: preprocessor macro inside string literal? Pin
cmk1-May-07 11:45
cmk1-May-07 11:45 
AnswerRe: preprocessor macro inside string literal? Pin
Stephen Hewitt30-Apr-07 17:44
Stephen Hewitt30-Apr-07 17:44 
GeneralRe: preprocessor macro inside string literal? Pin
PJ Arends1-May-07 5:21
professionalPJ Arends1-May-07 5:21 
QuestionC++ help for arrays...average a value Pin
wertyou29-Apr-07 17:00
wertyou29-Apr-07 17:00 
AnswerRe: C++ help for arrays...average a value Pin
PJ Arends29-Apr-07 17:15
professionalPJ Arends29-Apr-07 17:15 
GeneralRe: C++ help for arrays...average a value Pin
wertyou29-Apr-07 17:17
wertyou29-Apr-07 17:17 
GeneralRe: C++ help for arrays...average a value Pin
PJ Arends29-Apr-07 17:32
professionalPJ Arends29-Apr-07 17:32 
GeneralRe: C++ help for arrays...average a value Pin
wertyou29-Apr-07 17:42
wertyou29-Apr-07 17:42 
Questionhow to get temp folder path Pin
near2world29-Apr-07 5:04
near2world29-Apr-07 5:04 
AnswerRe: how to get temp folder path Pin
#realJSOP29-Apr-07 6:15
professional#realJSOP29-Apr-07 6:15 
GeneralRe: how to get temp folder path [modified] Pin
near2world30-Apr-07 3:16
near2world30-Apr-07 3:16 
GeneralRe: how to get temp folder path Pin
#realJSOP30-Apr-07 13:05
professional#realJSOP30-Apr-07 13:05 
GeneralRe: how to get temp folder path Pin
near2world1-May-07 0:19
near2world1-May-07 0:19 
AnswerRe: how to get temp folder path Pin
Mark Salsbery29-Apr-07 7:57
Mark Salsbery29-Apr-07 7:57 
GeneralRe: how to get temp folder path Pin
near2world30-Apr-07 3:19
near2world30-Apr-07 3:19 
GeneralRe: how to get temp folder path Pin
Mark Salsbery30-Apr-07 6:13
Mark Salsbery30-Apr-07 6:13 

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.