Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Porting from VC6, Class Wizard Comments

0 views
Skip to first unread message

AVee

unread,
Oct 14, 2008, 12:12:30 PM10/14/08
to
Am I correct in assuming that all the Class Wizard comment insertions,
//{{AFX_ , are ignored by VS2008, and can be safely removed prior to porting
a project from VC6 to VS2008?


asellon

unread,
Oct 14, 2008, 12:24:22 PM10/14/08
to
I have been doing that in VS2005. I take code worked in VS6 and remove the
#ifdef blocks, replace them with #pragma once, and then cut out all the
classwizard specific comments. I haven't had any problems doing it and I
like the cleaner look.

Andy
"AVee" <AV...@community.nospam> wrote in message
news:uADGqehL...@TK2MSFTNGP03.phx.gbl...

AVee

unread,
Oct 14, 2008, 12:57:13 PM10/14/08
to
Thanks, Andy. It's helpful to corroborate experience. BTW, it's nice that
#pragma once works now.

Best regards,
AVee

"asellon" <ase...@cox.net> wrote in message
news:YI3Jk.486$ke3...@newsfe10.iad...

Joseph M. Newcomer

unread,
Oct 14, 2008, 1:19:00 PM10/14/08
to
#pragma once has worked in all versions of VS since VS6.
joe

Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm

Ian Semmel

unread,
Oct 14, 2008, 1:29:15 PM10/14/08
to
Although I liked the grouping of like with like.

VS seems to add functions and controls wherever it wants to, usually not where I want them.

Joseph M. Newcomer

unread,
Oct 14, 2008, 2:16:19 PM10/14/08
to
I am always rearranging the header files because the wizards not only put things wherever
they want to, they always get it wrong. Can anyone explain the stupidity where message
handlers are declared "public"? Why would I want to have some other class call my message
handlers directly? So I mark them all "protected".

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:

AliR (VC++ MVP)

unread,
Oct 14, 2008, 4:09:28 PM10/14/08
to
Is it just me that thinks that "#pragma once" should be implied!!!! Same
with precompiled headers.

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...

BobF

unread,
Oct 14, 2008, 4:17:30 PM10/14/08
to

I agree. I guess you could modify your wizard templates to include it
(pun intended).

Joseph M. Newcomer

unread,
Oct 14, 2008, 9:29:14 PM10/14/08
to
The "include guards" which are the #ifndef/#define/#endif sequence were required through
VS4.2. They were not required after that. If you look at a standard VS6 file it says

#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 (VC++ MVP)

unread,
Oct 15, 2008, 11:01:34 AM10/15/08
to
Either way #ifdef sequence, or #pragma once, it should be implied, the
programmer shouldn't have to type that at the top of every header file!

AliR.


"Joseph M. Newcomer" <newc...@flounder.com> wrote in message

news:1fhaf4hfi4ft3kntd...@4ax.com...

Joseph M. Newcomer

unread,
Oct 15, 2008, 11:25:06 AM10/15/08
to
Why? Why are you making the assumption that a header file is included exactly once? As I
indicated, there are very often interesting scenarios when a header file can be included
several times in a single build module.
joe

AliR (VC++ MVP)

unread,
Oct 15, 2008, 11:59:18 AM10/15/08
to
Joe you got it backwards. I'm saying that I haven't seen too many projects
where a header file only gets included once. Therefore the compiler should
do what it does when the "#pragma once" in place all the time, whether it is
actually typed there or not.

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...

Damir Valiulin

unread,
Oct 15, 2008, 12:34:03 PM10/15/08
to

"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!

Joseph M. Newcomer

unread,
Oct 15, 2008, 3:41:19 PM10/15/08
to
No. That is not consistent with the specifications of #include, which is to include the
file at the point where the #include happens.

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

Doug Harrison [MVP]

unread,
Oct 15, 2008, 6:17:52 PM10/15/08
to
On Wed, 15 Oct 2008 10:59:18 -0500, "AliR \(VC++ MVP\)"
<Al...@online.nospam> wrote:

>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

Joseph M. Newcomer

unread,
Oct 15, 2008, 10:18:52 PM10/15/08
to
Unix use to rely on inode identity for determining things like file equivalence under
softlinks. Windows does not have an analogous concept.
joe

0 new messages