Click here to Skip to main content
15,900,108 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: erasing makefile / make DEFINES ? Pin
Salvatore Terress15-Apr-24 13:09
Salvatore Terress15-Apr-24 13:09 
Questionundefined reference - please help with linker issue Pin
Salvatore Terress11-Apr-24 8:37
Salvatore Terress11-Apr-24 8:37 
AnswerRe: undefined reference - please help with linker issue Pin
Richard Andrew x6411-Apr-24 9:25
professionalRichard Andrew x6411-Apr-24 9:25 
AnswerRe: undefined reference - please help with linker issue Pin
Richard MacCutchan11-Apr-24 21:01
mveRichard MacCutchan11-Apr-24 21:01 
QuestionBreak in a for loop Pin
Calin Negru11-Apr-24 1:19
Calin Negru11-Apr-24 1:19 
AnswerRe: Break in a for loop Pin
Mircea Neacsu11-Apr-24 1:28
Mircea Neacsu11-Apr-24 1:28 
AnswerRe: Break in a for loop Pin
Maximilien11-Apr-24 2:43
Maximilien11-Apr-24 2:43 
GeneralRe: Break in a for loop Pin
Calin Negru11-Apr-24 3:08
Calin Negru11-Apr-24 3:08 
GeneralRe: Break in a for loop Pin
CPallini11-Apr-24 4:17
mveCPallini11-Apr-24 4:17 
GeneralRe: Break in a for loop Pin
trønderen11-Apr-24 7:30
trønderen11-Apr-24 7:30 
GeneralRe: Break in a for loop Pin
Greg Utas11-Apr-24 7:50
professionalGreg Utas11-Apr-24 7:50 
AnswerRe: Break in a for loop Pin
BernardIE531717-Apr-24 12:01
BernardIE531717-Apr-24 12:01 
Question#define #undefine #define sequence result ? Pin
Salvatore Terress10-Apr-24 5:12
Salvatore Terress10-Apr-24 5:12 
AnswerRe: #define #undefine #define sequence result ? Pin
Mircea Neacsu10-Apr-24 5:14
Mircea Neacsu10-Apr-24 5:14 
AnswerRe: #define #undefine #define sequence result ? Pin
Richard MacCutchan10-Apr-24 6:36
mveRichard MacCutchan10-Apr-24 6:36 
AnswerRe: #define #undefine #define sequence result ? Pin
Salvatore Terress10-Apr-24 7:28
Salvatore Terress10-Apr-24 7:28 
AnswerRe: #define #undefine #define sequence result ? Pin
Salvatore Terress10-Apr-24 7:28
Salvatore Terress10-Apr-24 7:28 
Question#include - again Pin
Salvatore Terress5-Apr-24 5:06
Salvatore Terress5-Apr-24 5:06 
AnswerRe: #include - again Pin
Richard MacCutchan5-Apr-24 5:10
mveRichard MacCutchan5-Apr-24 5:10 
AnswerRe: #include - again Pin
Mircea Neacsu5-Apr-24 5:28
Mircea Neacsu5-Apr-24 5:28 
GeneralRe: #include - again Pin
trønderen5-Apr-24 6:01
trønderen5-Apr-24 6:01 
GeneralRe: #include - again Pin
trønderen5-Apr-24 6:14
trønderen5-Apr-24 6:14 
Mircea Neacsu wrote:
Another strategy is to use an “uber include” that includes all or a lot of other h files, but it can slow down compilation.
I could challenge you to create a setup to prove the significance of this: A compilation that would consistently take noticeably (more than 1%) longer compilation time with an "uber include" than with individual includes for what you really need. I am quite sure that for an example showing significant higher compilation times, you would have to make a system wide search for .h files and include them all in the "uber" file Smile | :)

There are other good reasons for avoiding the "uber" approach, though: Pollution of the name space. Not because I worry about symbol table sizes, but about too many symbols being acceptable. Sort of in the same class as languages that doesn't require declaration: If you misspell a name, it is not a misspelling, but creation of a new variable. Or, if your language lets you make local redefinitions of names in an outer scope: Remove the local (re)definition, and your code will reference a completely different variable. The "uber" approach makes available to you a whole lot that you are not aware of, not its origins. You won't have an error message that a declaration is missing. You don't know what you are making use of. One day someone adds a similarly defined function to your project, doing things in a different way, and your code fails ...

Ideally, you should know every single instruction your code executes. That is of course impossible; we have to rely on libraries, OS functions etc., but we select them, deliberately and concerned. The "uber" approach invites to introducing a lot of code that is not at all selected, neither deliberately nor concerned, it just is there, ready to manipulate your data in ways that you do not know.

Blackboxing principles go both ways: Your class, module, namespace or whatever should not expose more of itself that what is absolutely necessary for others to know. But at the same time: Inside that black box, you should not see more of the environment than absolutely necessary for the blackbox to know. One of the nice features of VS is that it tells when you are using namespaces, but not using any names from them!

Religious freedom is the freedom to say that two plus two make five.

GeneralRe: #include - again Pin
Salvatore Terress10-Apr-24 5:03
Salvatore Terress10-Apr-24 5:03 
GeneralRe: #include - again Pin
trønderen10-Apr-24 6:53
trønderen10-Apr-24 6:53 
GeneralRe: #include - again Pin
BernardIE531717-Apr-24 12:11
BernardIE531717-Apr-24 12:11 

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.