February 16, 2012
On 15/02/2012 16:41, Jonathan M Davis wrote:
<snip>
> They're not left over at all, and they have nothing to do with octal.
<snip>

They are something to do with octal: because in D an integer literal beginning with 0 is defined to be octal, the compiler must interpret them as such if it is going to accept them at all.

Of course, under current D2 without -d, the compiler rejects zero-led integer literals greater than 07.  But it's because of this octal legacy that it accepts up to 07 but not 08, 09 or 010.

Still, what's the long-term plan?  To remove octal literals completely, and allow decimal literals to have leading 0s?  Or to continue to allow just up to 07 until the end of time?

Stewart.
February 16, 2012
On Thursday, February 16, 2012 00:38:10 Stewart Gordon wrote:
> On 15/02/2012 16:41, Jonathan M Davis wrote:
> <snip>
> 
> > They're not left over at all, and they have nothing to do with octal.
> 
> <snip>
> 
> They are something to do with octal: because in D an integer literal beginning with 0 is defined to be octal, the compiler must interpret them as such if it is going to accept them at all.
> 
> Of course, under current D2 without -d, the compiler rejects zero-led integer literals greater than 07. But it's because of this octal legacy that it accepts up to 07 but not 08, 09 or 010.

They have nothing to do with octal in that they were not intentionally octal. I was merely using the leading 0 without thinking about it, because having leading 0s generally makes more sense when dealing with the date/time stuff. The fact that they were octal is incidental. They result in the same number either way, save for 08 and 09 not working.

> Still, what's the long-term plan? To remove octal literals completely, and allow decimal literals to have leading 0s? Or to continue to allow just up to 07 until the end of time?

I expect that we will never allow decimal literals with leading 0s which would end up with different numbers than they would if we supported octal literals, because otherwise any C/C++ code which is ported to D and uses octal literals will then compile with different semantics, and that's generally verboten in D (there are a few exceptions, but they're quite rare). I'm not aware of Walter actually having stated what his longterm plan is though.

- Jonathan M Davis
February 18, 2012
On Thursday, February 16, 2012 00:38:10 Stewart Gordon wrote:
> On 15/02/2012 16:41, Jonathan M Davis wrote:
> <snip>
> 
> > They're not left over at all, and they have nothing to do with octal.
> 
> <snip>
> 
> They are something to do with octal: because in D an integer literal beginning with 0 is defined to be octal, the compiler must interpret them as such if it is going to accept them at all.

They have nothing to do with octal in that they were not intentionally octal. I was merely using the leading 0 without thinking about it, because having leading 0s generally makes more sense when dealing with the date/time stuff. The fact that they were octal is incidental. They result in the same number either way, save for 08 and 09 not working.

> 
> Still, what's the long-term plan? To remove octal literals completely, and allow decimal literals to have leading 0s? Or to continue to allow just up to 07 until the end of time?
> 
> Stewart.
February 18, 2012
"Jonathan M Davis" <jmdavisProg@gmx.com> wrote in message news:mailman.508.1329531876.20196.digitalmars-d-learn@puremagic.com...
>
> They have nothing to do with octal in that they were not intentionally
> octal.
> I was merely using the leading 0 without thinking about it, because having
> leading 0s generally makes more sense when dealing with the date/time
> stuff.
> The fact that they were octal is incidental. They result in the same
> number
> either way, save for 08 and 09 not working.
>

While we can't ever allow leading zeroes in the general case, to catch errors porting ocal literals from c family languages, 08 and 09 could actually be supported in the future.


Next ›   Last »
1 2
Top | Discussion index | About this forum | D home