Octal literals: who uses this?
Walter Bright
newshound1 at digitalmars.com
Tue Mar 17 11:03:07 PDT 2009
Don wrote:
> and what the heck does "\000000\000000000\000\0000" mean?
It doesn't matter, because if you're translating C code to D, the code
is probably correct even if you don't know what it means.
> I doubt there is much extant C code which uses octal. Automated
> translations of octal literals can be done accurately, and you're even
> supplying the 'htod' converter!
htod is not intended for creating implementation source code. It's just
for headers. I expect most C translations will be done by hand.
> Note that C# doesn't have octal literals, but does include \0. So
> there's a precedent for dropping them. This also means that right now,
> converting code from C# to D can also introduce obscure bugs. I'd argue
> that that's a scenario that is at least as likely as bugs from C.
It is a good point, but I don't see people translating C# to D. But I do
see translating C to D (I do it myself!).
> I think the argument for octal is very, very weak.
The issue is really the cost of it being in vs the benefit of pulling it
out. I see very little cost of leaving it in, so it doesn't need much
benefit to make it worthwhile.
More information about the Digitalmars-d
mailing list