Where's the beef?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I posted this question on 8-23, and await a "managed" response:

Is it possible to define a macro substitution in the C++ preprocessor so
that it will be replaced "as if" it were defined within the source code?

In other words, I would like the preprocessor to expand this:

#include "..\_MYPATH_\myfile.h"

to this:

#include "..\MySpecificPath\myfile.h"

without having to include this line of code in each file

#define _MYPATH_ MySpecificPath

The reason that this is so important to me is because our company has become
heavily invested in MFC, and certain capabilities (Class Wizard & Browser
features) essential to efficiently maintain large MFC projects have been
dropped in VS.NET - AND, once project files are converted to VS.NET, they are
no longer usable under previous development systems. Also, it is impossible
to turn off deprecated warning C4996 - making portability harder yet to
manage ... and suggested replacements for deprecated functions are not easily
linked into the older development system (VC6).

Since portability to VS.NET has proved to be extensive, we need to maintain
production source files under VC++ during the process. The only method that I
see is viable is by accommodating the compiler differences in compiler
dependent headers, and calling the appropriate header by means of a
predefined macro in the project.

So - in order to reliably port large amounts of (tested and reliable) code,
I need to be able to call in different header files depending on the version
of compiler that I am using - at least until Microsoft reintroduces MFC
maintenance features that were dropped. I am hoping NOT to have to introduce
gazillions of #ifdef's, only needing to remove them once porting is complete.

And by the way - it's my opinion that developers would be MORE inclined to
migrate to newer MS technologies (managed code) if MFC support were enhanced,
not diminished (so as to force our hand). On what basis can developers be
assured that their investment in the new technology will be preserved?

Anyway - when I purchased MSDN I was assured of 48 hour managed response.
It's been eight days now. Can someone answer my simple question? "Can macro
substitutions be made by the project's preprocessor or not?". If not - fine,
#ifdef's it is. If so, how?

- otherwise please suggest or point me to information on the "suggested"
method of maintaining large MFC projects while porting to emerging MS
development systems.

.



Relevant Pages

  • Re: tolower macro
    ... tolower is a macro defined like this. ... between a lower case character and it's uppercase equivalent. ... Does the preprocessor just ... replacing the character sequences given inside the macro as the names ...
    (comp.lang.c.moderated)
  • Re: Mapping source instructions to machine instructions
    ... reality as well) operates in two separate phases. ... This isn't really much different from a C compiler and its preprocessor. ... m4 macro processor before feeding the output to the assembler proper. ... Anyway, in many, perhaps most, assemblers the macro processor is very ...
    (alt.lang.asm)
  • Re: Computing a*b/c without overflow in the preprocessor
    ... positive integer constant expressions a b c, ... constant expression evaluable by the preprocessor and equal to a*b/c ... the same macro several times. ... If the expansion gets too big and slow to compile: ...
    (comp.lang.c)
  • Re: Controls - Not receiving key messages ON_WM_KEYDOWN
    ... I guess I have to set a break point on the Macro. ... Setting a breakpoint on a Macro doesn't work. ... I did not forsee creating controls out of the objects beforhand, so what worked before when it was an object does not work now. ... When MFC receives messages, they are not in that format, they are more relevant. ...
    (microsoft.public.vc.mfc)
  • Re: The C++ Preprocessor [Re: Boost Workshop at OOPSLA 2004]
    ... > Not it only remains for me to convince you that that's a disadvantage ... wholly different language. ... the primary implementation macro becomes: ... Obviously the preprocessor is ...
    (comp.lang.cpp)