Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 1727: Add include with #pragma once (C++)

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
kempus Posted - Jul 09 2009 : 05:12:12 AM
This is only a small annoyance, but when you add an include (using refactoring) in a header file, if there are no includes already, it adds it before #pragma once at the top of the file.

Thanks, Tim


#pragma once

class A
{
  CUnknown m_Member;
}


after adding include for CUnknown using VAX, you get


#include "unknown.h"
#pragma once

class A
{
  CUnknown m_Member;
}

3   L A T E S T    R E P L I E S    (Newest First)
support Posted - Jan 31 2010 : 1:24:41 PM
case=29480 is fixed in build 1810
feline Posted - Jul 11 2009 : 2:05:51 PM
I can see that it would look better if the #include statement went after the #pragma once:

case=29480

In general VA is not going to know the "correct" place for the #include line, but moving it should be a lot quicker than adding it manually in the right place.
mwb1100 Posted - Jul 09 2009 : 12:43:19 PM
This is only a cosmetic issue. The #pragma once marks the entire header (presumably a.h) to only be included that one time. If a.h is brought in by a subsequent #include in the same compilation unit, the whole thing is skipped - not just the stuff after the #pragma once.

In other words, a #pragma once anywhere in the header file is equivalent to a #pragma once at the top of the header file (except that the #pragma once can be 'disabled' with a conditional compilation directive).


So unknown.h will not be brought in twice (at least not via a.h).

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000