Script replacing '#include <stdafx.h>' with corresponding '#include'.
These references to '<stdafx.h>' are somewhat ambiguous, and hard to follow; they all look similar and have the same name after all. As vast majority refer to single header ('CPP/Common/Common.h') it makes things easier and cleared to use direct reference to corresponding header. Also '#pragma warning(disable : 4464)' is removed as it is already in mentioned 'Common.h'.</stdafx.h></stdafx.h>
put all the scripts in 7-zip source and run:
$ sh replace-stdafx-1.sh
It will do its job, create backup files and touch them if KEEP_DATES is exported {default}.
You will need bash, grep and sed to do it. Either from MSYS, Cygwin, or Linux.
There is a diff showing effects if you wanted to check it first.
Hope you find it useful.
Here is aforementioned script.
stdafx.h
is for precompilation.It improves compiling speed for several times in MSVC (Windows).
I get that, can you add `CPP/Common/Common.h'? It should be done somehow - the, seemingly, the same StdAfx.h. I tried to do it but don't know how to add multiple paths ('Common.h', '../Common/Common.h', '../../Common/Common.h', ) or absolute path for that matter, as they all point to the very same header.
Also the several times is bit of exaggeration. Just tested it, and it is 2-2.5 times faster, but you can improve it more by using better make engine, like jom that is nmake 'clone', in a sense of syntax compatibility, and do it 8, or 12 times faster; not just 2, depending on your CPU cores. Also with new computers that 2-times is like half a minute, and when you code/edit/debug your code you compile just one or two files where all precompiled headers don't matter anyways.
I didn't want to raise 'windows-ish-ness' but this StdAfx.h thing is as Windows-ish ac CRLF.
Same thing.
we need precompilation.
so we need some name for that file.
StdAfx.h
is good name for that file, because it was already selected for that task in MS compilers.We do not want to create additional things, if there is standard thing already for that task.
cl.exe
in nmake is also multithreaded for new MSVC compilers.also compile time is important, if we change
h
files.Also I use MSVC6 for edit/debug. So I get faster compiling with precompiler with that old compiler.
Last edit: Igor Pavlov 2024-03-29