| Thread overview | ||||||||
|---|---|---|---|---|---|---|---|---|
|
March 15, 2008 \ OctalDigit etc. | ||||
|---|---|---|---|---|
| ||||
This was probably discussed before. But I run into a problem when I was checking for missing characters in a long string sequence since some application kept telling me that it was invalid. The point was that \012 is not '\0' '1' '2' but one char '\012'. other representations with hexadecimal numbers have an alphabetical char to indicate smth. special might follow (\xaa). In my case thinking of \0 being the same as single char and in a string was wrong. This is inconsistent and I think many could get wrong as I did. I don't have much hope to get a convenient solution as for hexadecimal representations. But I thought I just post this for others who stumble over the same stone. :/ | ||||
March 20, 2008 Re: \ OctalDigit etc. | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Moritz Warning | The way the octal escape sequences work is pretty standard practice. To change it would be to confuse the other half of people who use it :-( | |||
March 20, 2008 Re: \ OctalDigit etc. | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | == Quote from Walter Bright (newshound1@digitalmars.com)'s article
> The way the octal escape sequences work is pretty standard practice. To change it would be to confuse the other half of people who use it :-(
The format of octal literals is one of the more harebrained ideas we've inherited from C. I'd love to require an "0o" prefix or something of the sort, but it would cause unnecessary trouble for ported C code. Ah well.
Sean
| |||
March 20, 2008 Re: \ OctalDigit etc. | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Sean Kelly | Sean Kelly:
> The format of octal literals is one of the more harebrained ideas we've inherited from C. I'd love to require an "0o" prefix or something of the sort, but it would cause unnecessary trouble for ported C code. Ah well.
Just fixed in Python 3.0 ;-) Among many other things. But I too can see the situation is different: you usually don't port much code from C to Python.
Bye,
bearophile
| |||
March 20, 2008 Re: \ OctalDigit etc. | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | "Walter Bright" <newshound1@digitalmars.com> wrote in message news:frs9ov$2258$1@digitalmars.com... > The way the octal escape sequences work is pretty standard practice. To change it would be to confuse the other half of people who use it :-( People use them? | |||
March 20, 2008 Re: \ OctalDigit etc. | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | Jarrett Billingsley wrote:
> "Walter Bright" <newshound1@digitalmars.com> wrote in message news:frs9ov$2258$1@digitalmars.com...
>
>>The way the octal escape sequences work is pretty standard practice. To change it would be to confuse the other half of people who use it :-(
>
>
> People use them?
>
>
People is simply plural. Therefor, if there are 2 people who use them, then the statement is correct (but not particularly useful). As to if /enough/ people use them to be worth anything...
Also, I expect you (and most anyone) use them regularly because \0 is actual a 1 char octal escape sequence.
That still has little bearing on the topic though.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply