Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » _pick understanding
Re: _pick understanding [message #26396 is a reply to message #26372] Thu, 29 April 2010 23:38 Go to previous message
mirek is currently offline  mirek
Messages: 14265
Registered: November 2005
Ultimate Member
cbpporter wrote on Wed, 28 April 2010 05:27

I believe that the different defines are because in default mode, MSC is not 100% compliant with C++ standard and is a little more allowing than it should be. Basically, it allows you to not use const in some cases where const should be used. This dates back from the golden era of MFC AFAIK.

Please correct me if I'm wrong.



You are right.

Quote:


I would like to see const added to pick for MSC too on a pure ideological level, but I have no practical consideration that would make me change that.


There is a practical reason why we "exploit" this MSC bug:

Doing so, we are able to catch some pick semantics bugs at compile time. E.g.

void Foo(const Vector<int>& b) {
   Vector<int> a;
   a = b;
}


does not compile with MSC (which is correct).

(Frankly, I believe that M$ got it right here and standard has it wrong Smile

Note: Thankfully M$ seems to use its own semantics in MFC in some places, therefore they perhaps have to keep this non-compliance to standard.

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: FEATURE: T* ArrayIndex::Detach(int i) AND mini fix
Next Topic: what about VectorBiMap / ArrayBiMap ?
Goto Forum:
  


Current Time: Sun Jul 06 05:37:25 CEST 2025

Total time taken to generate the page: 0.02654 seconds