Click here to Skip to main content
14,326,311 members

C / C++ / MFC

 
GeneralRe: error C2143 Pin
Richard MacCutchan11-Oct-19 1:24
protectorRichard MacCutchan11-Oct-19 1:24 
GeneralRe: error C2143 Pin
_Flaviu11-Oct-19 4:28
member_Flaviu11-Oct-19 4:28 
GeneralRe: error C2143 Pin
Richard MacCutchan11-Oct-19 5:04
protectorRichard MacCutchan11-Oct-19 5:04 
AnswerRe: error C2143 Pin
David Crow10-Oct-19 10:44
memberDavid Crow10-Oct-19 10:44 
AnswerRe: error C2143 Pin
Daniel Pfeffer11-Oct-19 4:47
professionalDaniel Pfeffer11-Oct-19 4:47 
GeneralRe: error C2143 Pin
_Flaviu12-Oct-19 23:44
member_Flaviu12-Oct-19 23:44 
GeneralRe: error C2143 Pin
_Flaviu12-Oct-19 23:46
member_Flaviu12-Oct-19 23:46 
QuestionHow can I have several hundred of #if defined(XXX) ... #endif in an easy-to-read table format? Pin
arnold_w9-Oct-19 11:55
memberarnold_w9-Oct-19 11:55 
This question is somewhat related to the question Passing a "value", that was either #defined or #undef, into a macro and check if it was defined? - C / C++ / MFC Discussion Boards[^] , but the core question in this thread is quite different than that of the other thread so I think this should be a separate thread. In the other thread I was looking to have a macro do my checks, but it would be ok to do it without a macro as well. The important thing is that the checks (there are several hundreds of them) are nicely formatted in way that makes it easy to read. So, is it possible to achieve something like this with some clever workaround:
#if defined(ADDR1) && defined(ADDR2) _Static_assert(ADDR1==ADDR2, #ADDR1 " is not equal to " #ADDR2);  #endif
#if defined(ADDR3) && defined(ADDR4) _Static_assert(ADDR3==ADDR4, #ADDR3 " is not equal to " #ADDR4);  #endif
#if defined(ADDR5) && defined(ADDR6) _Static_assert(ADDR5==ADDR6, #ADDR5 " is not equal to " #ADDR6);  #endif
#if defined(ADDR7) && defined(ADDR8) _Static_assert(ADDR7==ADDR8, #ADDR7 " is not equal to " #ADDR8);  #endif
As you can see, the "correct" way of doing this (the way the compiler wants it) is not easy to read at all (and not so easy to generate in Excel or edit using the block caret feature in Eclipse):
#if defined(ADDR1) && defined(ADDR2)    
    _Static_assert(ADDR1 == ADDR2, #ADDR1 " is not equal to " #ADDR2);
#endif
#if defined(ADDR3) && defined(ADDR4)
    _Static_assert(ADDR3 == ADDR4, #ADDR3 " is not equal to " #ADDR4);
#endif
#if defined(ADDR5) && defined(ADDR6)
    _Static_assert(ADDR5 == ADDR6, #ADDR5 " is not equal to " #ADDR6);
#endif
#if defined(ADDR7) && defined(ADDR8)
    _Static_assert(ADDR7 == ADDR8, #ADDR7 " is not equal to " #ADDR8);
#endif
Can anyone think of a neat trick? Maybe something involving #include files? I think I've read somewhere that you can have several #include on the same line.

modified 5 days ago.

QuestionRe: How can I have several hundred of #if defined(XXX) ... #endif in an easy-to-read table format? Pin
Richard MacCutchan9-Oct-19 21:41
protectorRichard MacCutchan9-Oct-19 21:41 
AnswerRe: How can I have several hundred of #if defined(XXX) ... #endif in an easy-to-read table format? Pin
arnold_w9-Oct-19 21:54
memberarnold_w9-Oct-19 21:54 
GeneralRe: How can I have several hundred of #if defined(XXX) ... #endif in an easy-to-read table format? Pin
Richard MacCutchan9-Oct-19 22:10
protectorRichard MacCutchan9-Oct-19 22:10 
GeneralRe: How can I have several hundred of #if defined(XXX) ... #endif in an easy-to-read table format? Pin
arnold_w9-Oct-19 22:20
memberarnold_w9-Oct-19 22:20 
GeneralRe: How can I have several hundred of #if defined(XXX) ... #endif in an easy-to-read table format? Pin
Richard MacCutchan9-Oct-19 22:36
protectorRichard MacCutchan9-Oct-19 22:36 
GeneralRe: How can I have several hundred of #if defined(XXX) ... #endif in an easy-to-read table format? Pin
arnold_w9-Oct-19 23:00
memberarnold_w9-Oct-19 23:00 
AnswerRe: How can I have several hundred of #if defined(XXX) ... #endif in an easy-to-read table format? Pin
CPallini10-Oct-19 3:03
mveCPallini10-Oct-19 3:03 
GeneralRe: How can I have several hundred of #if defined(XXX) ... #endif in an easy-to-read table format? Pin
arnold_w10-Oct-19 4:27
memberarnold_w10-Oct-19 4:27 
GeneralRe: How can I have several hundred of #if defined(XXX) ... #endif in an easy-to-read table format? Pin
CPallini10-Oct-19 6:12
mveCPallini10-Oct-19 6:12 
QuestionProblem with AlphaBlend. Pin
Member 126614649-Oct-19 6:57
memberMember 126614649-Oct-19 6:57 
QuestionRe: Problem with AlphaBlend. Pin
Richard MacCutchan9-Oct-19 8:49
protectorRichard MacCutchan9-Oct-19 8:49 
AnswerRe: Problem with AlphaBlend. Pin
Member 126614649-Oct-19 9:09
memberMember 126614649-Oct-19 9:09 
GeneralRe: Problem with AlphaBlend. Pin
Richard MacCutchan9-Oct-19 9:34
protectorRichard MacCutchan9-Oct-19 9:34 
QuestionPassing a "value", that was either #defined or #undef, into a macro and check if it was defined? Pin
arnold_w9-Oct-19 6:07
memberarnold_w9-Oct-19 6:07 
AnswerRe: Passing a "value", that was either #defined or #undef, into a macro and check if it was defined? Pin
k50549-Oct-19 6:48
memberk50549-Oct-19 6:48 
AnswerRe: Passing a "value", that was either #defined or #undef, into a macro and check if it was defined? Pin
Richard MacCutchan9-Oct-19 8:47
protectorRichard MacCutchan9-Oct-19 8:47 
GeneralRe: Passing a "value", that was either #defined or #undef, into a macro and check if it was defined? Pin
arnold_w9-Oct-19 9:14
memberarnold_w9-Oct-19 9:14 

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.