octal literals, was Re: Implicit enum conversions are a stupid PITA

Don nospam at nospam.com
Fri Mar 26 01:07:40 PDT 2010


Rainer Deyke wrote:
> On 3/25/2010 23:40, Walter Bright wrote:
>> Rainer Deyke wrote:
>>> I don't mind octal literals, but '0177' is a horrible syntax.  *Every*
>>> *single* *time* that I used that syntax in C or C++, I really meant to
>>> use a decimal.
>> I'm curious what tempted you to use a leading 0 in the first place.
> 
> Padding to get an array literal to align properly.  Something like this:
> 
> int a[3][3] = {
>   {001, 002, 003},
>   {010, 020, 030},
>   {100, 200, 300},
> };
> 
> I could have used (and should have used, and eventually did use) spaces
> instead, but I don't think they look as nice in this instance.
> 
> 
Yes, because spaces have different widths to digits in most mono-spaced 
fonts.



More information about the Digitalmars-d mailing list