In http://reviews.llvm.org/D9044#161258, @EricWF wrote:
> In http://reviews.llvm.org/D9044#156827, @eugenis wrote: > > > In http://reviews.llvm.org/D9044#156813, @EricWF wrote: > > > > > You'll need to use reserved identifiers > > > > > > Do you mean for local variable names? Is there a technical reason for this, > > or just a code style thing? > > > For any name not defined in the standard you should use reserved identifiers. > Assume that the user of the standard library defines every non-reserved, > non-defined name as a macro. We use reserved identifiers so that conforming > programs can define non-reserved names globally and still use the standard > library. > > For example: > > #define PopulationIterator char* > #define SampleIterator char* > #define UniformRandomNumberGenerator &rand > #include <experimental/algorithm> > Good point, will do. > > > > > and guard the definition of `sample` inside a C++14 only block because > > > adding a new definition of could break existing code. > > > > > > > > > n4335 does not seem to require that this is only available in C++14. And > > aren't names under std:: already reserved, and an addition of a new std:: > > name could not break compliant code? > > > I would prefer not to restrict these things to c++14 only, although there may > be a reason that conforming implementations need to that isn't visible in > n4335. > > However because `sample` is a function it can be looked up by ADL. Since > `sample` takes user-defined iterator types and RNG's it is possible that > existing unqualified calls to `sample` in user code may now find > `std::sample`. That's a valid concern, but limiting this definition to C++14 will still break existing C++14 code. Is it really that much better than breaking C++11 and C++14 at the same time? Also, that would be std::experimental::sample. REPOSITORY rL LLVM http://reviews.llvm.org/D9044 EMAIL PREFERENCES http://reviews.llvm.org/settings/panel/emailpreferences/ _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
