Andy
"AVee" <AV...@community.nospam> wrote in message
news:uADGqehL...@TK2MSFTNGP03.phx.gbl...
Best regards,
AVee
"asellon" <ase...@cox.net> wrote in message
news:YI3Jk.486$ke3...@newsfe10.iad...
Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
VS seems to add functions and controls wherever it wants to, usually not where I want them.
The "new improved" wizard-like entities were designed by someone who never, ever, in his
entire life, wrote a program. Never understood programming, C++, or MFC, but once heard
rumors about them.
And don't tell me they're great for VB or C#. At least for C#, they totally suck also.
joe
On Wed, 15 Oct 2008 03:29:15 +1000, Ian Semmel <isemme...@NOKUNKrocketcomp.com.au>
wrote:
Since 1990 I haven't done a project that didn't use precompile headers, and
I have always needed the #ifdef my header files!
I really can't think of an instance where you don't have to use #progma
once, unless the header is only going to be included in one cpp files.
AliR.
"Joseph M. Newcomer" <newc...@flounder.com> wrote in message
news:j3l9f49pjd9cl4t25...@4ax.com...
#if _MSC_VER > 1000
#pragma once
#endif
and VS version 1000 was VS4.2 (I just checked). My error, it was supported in VS5 and
beyond (I never installed VS5 anywhere because it had so many other problems, such as not
being able to build device drivers)
Thus, if you were using VS5 or later, you automatically had #pragma once for all the
MFC-generated files, and you could add it by hand for files of your own.
THe only place you currently need include guards is if you have a header file that is used
in multiple platforms, such as subroutines that are used in the Windows and linux versions
of an app.
So you certainly needed it in 1990, but you did not need it after VS5 was released. With
VS5 and later, all you needed was #pragma once
The problem is that it is often the case that people use #include of the same file more
than once in a single compilation unit (I've seen very interesting cases for this!), and
the C/C++ language specifications require that it work according to its specified
implementation.
joe
AliR.
"Joseph M. Newcomer" <newc...@flounder.com> wrote in message
news:1fhaf4hfi4ft3kntd...@4ax.com...
Why should we have to put #pragma once in every header file. if we have to
do it on every header file, shouldn't it be automatic!
AliR.
"Joseph M. Newcomer" <newc...@flounder.com> wrote in message
news:1p2cf49705qhcgr7u...@4ax.com...
"Joseph M. Newcomer" wrote:
> ...
> The "new improved" wizard-like entities were designed by someone who never, ever, in his
> entire life, wrote a program. Never understood programming, C++, or MFC, but once heard
> rumors about them.
>
> And don't tell me they're great for VB or C#. At least for C#, they totally suck also.
> joe
>
Ha-ha-ha! Excellent comment! I couldn't agree more on this. I want my Wizard
back please!
I've seen cases where this is used in C to obtain "generics", in that certain macros are
defined and a #include is done, and a body of code is generated. Then the macros are
redefined, and the #include happens again. With clever choice of how the macros are
defined, you can get the equivalent of "overloading" in C, which is interesting. Besides,
wer're taling about an international standard here, not something that can be readily
changed to save typing a dozen characters in a few files.
joe
>Why should we have to put #pragma once in every header file. if we have to
>do it on every header file, shouldn't it be automatic!
That would be nice, but with things like shares, hard/soft links, etc, it's
difficult for the compiler to reliably determine a file #included as
x1/y1.h is the same as one #included as x2/y2.h. Even explicit #pragma once
doesn't change this problem, which is probably one reason the gcc people
abandoned it a long time ago, in favor of specially recognizing the
#include guard idiom, which everyone was already using anyway.
--
Doug Harrison
Visual C++ MVP