Click here to Skip to main content
15,889,335 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C++ Typedefs Pin
Richard MacCutchan29-Jan-19 5:41
mveRichard MacCutchan29-Jan-19 5:41 
GeneralRe: C++ Typedefs Pin
David Crow29-Jan-19 6:20
David Crow29-Jan-19 6:20 
GeneralRe: C++ Typedefs Pin
Joe Woodbury29-Jan-19 9:45
professionalJoe Woodbury29-Jan-19 9:45 
GeneralRe: C++ Typedefs Pin
CPallini29-Jan-19 10:35
mveCPallini29-Jan-19 10:35 
GeneralRe: C++ Typedefs Pin
Stefan_Lang29-Jan-19 21:16
Stefan_Lang29-Jan-19 21:16 
GeneralRe: C++ Typedefs Pin
leon de boer30-Jan-19 3:20
leon de boer30-Jan-19 3:20 
QuestionWhere do you place your #includes? Pin
den2k8828-Jan-19 23:49
professionalden2k8828-Jan-19 23:49 
AnswerRe: Where do you place your #includes? Pin
Daniel Pfeffer29-Jan-19 0:32
professionalDaniel Pfeffer29-Jan-19 0:32 
If a header file depends for its compilation on another header file, the second header file is included in the first.
// header1.h

// depends on contents of header2.h for compilation
#include "header2.h"
If a source file depends for its compilation on a header file, that header file is included in the source file.
// source.c

// depends on contents of header1.h for compilation
#include "header1.h"

In your case, <windows.h> is needed only in the source file, so it is included only there. Note that this also helps porting - the header file (which is O/S-independent) does not need changing, but the source file (which is O/S-dependent) does.

I admit that my method could cause a file to be included multiple times. This is not as big a problem as it used to be:
  1. Modern compilers often cache header files
  2. SSDs are much faster than HDDs
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.

GeneralRe: Where do you place your #includes? Pin
den2k8829-Jan-19 21:12
professionalden2k8829-Jan-19 21:12 
AnswerRe: Where do you place your #includes? Pin
mo149229-Jan-19 2:27
mo149229-Jan-19 2:27 
GeneralRe: Where do you place your #includes? Pin
den2k8829-Jan-19 21:10
professionalden2k8829-Jan-19 21:10 
GeneralRe: Where do you place your #includes? Pin
Klaus-Werner Konrad24-Apr-19 4:31
Klaus-Werner Konrad24-Apr-19 4:31 
AnswerRe: Where do you place your #includes? Pin
CPallini29-Jan-19 10:49
mveCPallini29-Jan-19 10:49 
GeneralRe: Where do you place your #includes? Pin
den2k8829-Jan-19 21:07
professionalden2k8829-Jan-19 21:07 
GeneralRe: Where do you place your #includes? Pin
CPallini29-Jan-19 22:07
mveCPallini29-Jan-19 22:07 
AnswerRe: Where do you place your #includes? Pin
Stefan_Lang29-Jan-19 22:28
Stefan_Lang29-Jan-19 22:28 
AnswerRe: Where do you place your #includes? Pin
leon de boer30-Jan-19 2:26
leon de boer30-Jan-19 2:26 
QuestionPf Pin
Member 1412898028-Jan-19 8:25
Member 1412898028-Jan-19 8:25 
AnswerRe: Pf Pin
CPallini28-Jan-19 9:20
mveCPallini28-Jan-19 9:20 
QuestionWin API or other? Pin
chipp_zanuff26-Jan-19 5:12
chipp_zanuff26-Jan-19 5:12 
AnswerRe: Win API or other? Pin
Victor Nijegorodov26-Jan-19 5:33
Victor Nijegorodov26-Jan-19 5:33 
AnswerRe: Win API or other? Pin
Joe Woodbury28-Jan-19 12:37
professionalJoe Woodbury28-Jan-19 12:37 
AnswerRe: Win API or other? Pin
leon de boer28-Jan-19 17:07
leon de boer28-Jan-19 17:07 
Questionc++ MS Word Pin
Member 1238494426-Jan-19 5:03
Member 1238494426-Jan-19 5:03 
AnswerRe: c++ MS Word Pin
jeron126-Jan-19 6:30
jeron126-Jan-19 6:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.