extern nesting issue
- My team has a large solution (think a million+ of lines of C/C++ code) that we are porting from a non-MS environment to CE. Since a lot of the header files are used by a mix of C and C++ most tend to have the classic
wrapping their entire contents. The problem is that it appears that the microsoft compiler preprocessor doesn't handle extern nesting beyond a level of 10. (See http://msdn.microsoft.com/en-us/library/ft39hh4x(VS.71).aspx.) I'm not sure how many levels deep we need to go but it is clearly beyond this limit.#ifdef __cplusplus extern "C" { #endif ...
#ifdef __cplusplus } #endif
Short of touching a lot (and I do mean a lot) of header files, is there any way around this limit? It looks like this is a hard coded limit in the tool but does anyone know if is there a registry key or preprocessor command that will override it? Or does anyone know of a solution that won't involve touching a very large number of header files?
(It also begs the question of why what is supposed to be a world class tool falls so far short of the recommended value of 1024 that the C++ standard specifies?)
回答
BTW, there *is* a work around that involves touching the header files. The answer lies in use of #pragma push_macro and #pragma pop_macro to keep the state of whether the close bracket should be used and you only use the first extern "C" and corresponding close bracket.
I'm just hoping to find an answer that doesn't involve writing a perl script to touch *a lot* of header files.- 回答としてマークRong-Chun ZhangMSFT, Moderator2009年11月26日 10:03
- Hello,
After discussing with product team, fixing the header files seems to be the only workaround.
Thanks,
Rong-Chun Zhang
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- 回答としてマークRong-Chun ZhangMSFT, Moderator2009年11月26日 10:03
すべての返信
BTW, there *is* a work around that involves touching the header files. The answer lies in use of #pragma push_macro and #pragma pop_macro to keep the state of whether the close bracket should be used and you only use the first extern "C" and corresponding close bracket.
I'm just hoping to find an answer that doesn't involve writing a perl script to touch *a lot* of header files.- 回答としてマークRong-Chun ZhangMSFT, Moderator2009年11月26日 10:03
- Hello
Thanks for you post.
>It looks like this is a hard coded limit in the tool but does anyone know if is there a registry key or preprocessor command that will override it?
I don't think this can be override by the registry key as this is Compiler Limit. I will discuss with product team to see if this is an work around, I will get back to up as soon as possible.
Thanks,
Rong-Chun Zhang
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us. - Hello,
After discussing with product team, fixing the header files seems to be the only workaround.
Thanks,
Rong-Chun Zhang
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- 回答としてマークRong-Chun ZhangMSFT, Moderator2009年11月26日 10:03

