Implicit enum conversions are a stupid PITA

Walter Bright newshound1 at digitalmars.com
Thu Mar 25 15:12:14 PDT 2010


bearophile wrote:
> Regarding octals (and multi-precision integer literals, and unit system
> suffixes), it seems C++0x has user-defined literals :-) 
> http://en.wikipedia.org/wiki/C++0x#User-defined_literals (I am not asking to
> solve the D octal problem with them.)


The C++0x syntax for them to me appears to be a workaround for the bug that C++ 
templates cannot accept string literal arguments. As Andrei mentioned, the D 
version:

     Suffix!"string"

more than adequately replaces it, and has the advantage of not requiring the 
user to learn a new syntax.

Even better, D's user defined literals can be executed and resolved at compile 
time, while C++0x's are runtime only creations.



More information about the Digitalmars-d mailing list