#### Archived

This topic is now archived and is closed to further replies.

This topic is 6205 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Are there any rules or guidelines to follow that tell you when you need to perform a full compile? Am I the only one that runs into odd program behavior and spurious exceptions from incrementally compiled/linked code? (Full compiles seem to clear up alot of problems for me) Does this mean I have crap code & ram stompage? Or is the MSVC incremental linker bugged? (SP5) When I ran just a moment ago this code exploded:
  typedef std::list tyListObserver; tyListObserver m_listObserver; //... void AddObserver(TObserver* pObserver) { //BOOM! m_listObserver.insert(m_listObserver.end(), pObserver); } 
Now, unless the MS STL list is fubar (which I guess it could be), that code can''t fail! It doesn''t even matter if pObserver is null! And m_listObserver is created on the stack! After a full compile it runs flawlessly, in both debug & release builds! frustrating... Maybe it''s all the templates I use. Magmai Kai Holmlor - The disgruntled & disillusioned

##### Share on other sites
You are not alone there. I think that''t why shift-f7 maps to full rebuild 8)

##### Share on other sites
You may have some bugged code where you actually use this function, I have found in my experience anyway that in a full build some memory leak problems will not show up because there is no debug information available. I am pretty sure that the VC incremental linker is not bugged (I could be wrong of course) because it is such a fundamental element of C++.

I''ve had code that I could swear is flawless only to find out later I missed an obvious problem.

##### Share on other sites
My (uninformed) guess is this:

Templates and their linkage is a bit different to a normal functions. Normal functions can just be compiled to an object file, and all that any other object file needs to know is how many bytes to stick on the stack when calling that function. So normal functions (including member functions) can easily be compiled separately of each other, with it being trivial for the compiler to detect when everything else needs changing (eg. when the function prototype changes).

However, templates add a spanner to the works, in that there is technically a different compilation required for each type parameter you give to them. So you have one set of compilation for the syntax of the template itself, and one set for checking each individual instantiation.

So my guess is that, with an imperfect compiler, you probably need to do a full recompile whenever you do much with templates Although, I can''t say I''ve had any problems recently. I am just suggesting that sometimes, the compiler fails to guess all the complex template dependencies and doesn''t recompile everything it should.

Oh... and why not just do:
m_listObserver.push_back(pObserver);
... instead of calling both insert() and end()? Trying to be independent of the container type?

• 17
• 11
• 12
• 9
• 49
• ### Forum Statistics

• Total Topics
631395
• Total Posts
2999758
×