Hi, On Wed, 26 Sep 2012, Lawrence Crowl wrote:
> > A lower-case type name indicates to me a non-changing type, > > i.e. nothing that depends on a template. In C we only had > > such types so we used lower-case names everywhere. With C++ > > and templates I think we should start using upper case for some > > very specific use cases, like first letter of dependend types. > > How would you distinguish them from template parameter names, > which by convention have an upper case first letter? I wouldn't. If the distinction becomes so important that authors need to see the speciality immediately by having a different convention how to spell names, then I think we did something wrong, and we should simplify the code. > What about non-type dependent names? I'm not sure what you're asking. Let's make an example: template <typename T> struct D : B<T> { typedef typename B<T>::E E; // element_type E getme (int index); } In fact, as B<T>::E would probably be defined like "typedef typename T E", I would even have no issue to call the above E also T. The distinction between the template arg name and the typedef would be blurred, and I say, so what; one is a typedef of the other and hence mostly equivalent for practical purposes. (And if they aren't, then again, we did something too complicated with the switch to C++). > The advantage to following them is that they will surprise no one. They will surprise everyone used to different conventions, for instance Qt, so that's not a reason. > Do you have an alternate suggestion, one that does not confuse template > parameters and dependent names? Upper last character? Just kidding :) Too many detailed rules for conventions are the death of them, use rules of thumbs, my one would be "somehow depends on template args -> has upper character in name", where "somehow depends on" includes "is a". Ciao, Michael.