Implicit enum conversions are a stupid PITA

Don nospam at nospam.com
Thu Mar 25 22:23:05 PDT 2010


Walter Bright wrote:
> Nick Sabalausky wrote:
>> (I used C for years without being aware of that octal syntax - it's 
>> only by dumb luck I didn't try to use a leading zero). 
> 
> It is on the 3rd page of chapter 2 in K&R (and chapter 2 is the first 
> chapter of the specification).
> 
> A mitigating factor is who uses leading 0's for integer literals? 
> Another is if you started using leading 0's, very quickly you'd try 
> using the digits 8 or 9, and would get an error.
> 
> I don't think you'd get very far using leading 0's without discovering 
> the issue.
I've done it with powers of 10:
001,
010,
100

and then wondered why my code was wrong. It's the only time in my life 
I've ever used an octal literal.



More information about the Digitalmars-d mailing list