Implicit enum conversions are a stupid PITA

Adam D. Ruppe destructionator at gmail.com
Thu Mar 25 18:40:01 PDT 2010


On Thu, Mar 25, 2010 at 09:10:09PM -0400, Nick Sabalausky wrote:
> Supporting it means it will "silently and disastrously break code" from 
> anyone who tries to use a leading zero

This is why I'd like them banned. Sometimes I write things like

switch(a) {
	case 143: do something; break;
	case 642: do something; break;
	case 011: do something; break;
}

Using the leading zero just because I want it to line up in pretty columns.

It has been a long time since I've actually made this mistake and got bit
by it, but it has happened to me before. I'd feel better if it was a
compile error just to ensure it never happens again.

-- 
Adam D. Ruppe
http://arsdnet.net



More information about the Digitalmars-d mailing list