Topic: A Modest Proposal (was Why's of C++ -- Part 3 ...)
Author: David R Tribble <david@tribble.com>
Date: 1999/10/21 Raw View
Paul Jarc wrote:
>
> Chris Torek <torek@elf.bsdi.com> writes:
>> Instead of:
>>
>> "Hello world\n"
>>
>> users of ASCII-based systems can simply write:
>>
>> "\x48\x65\x6c\x6c\x6f\x20\x77\x6f\x72\x6c\x64\xa"
>
> But what about character sets that don't have 'x'? :)
"??/110??/145??/154??/157??/040??/167??/157??/162??/154??/144??/012"
;-)
-- David R. Tribble, david@tribble.com, http://www.david.tribble.com --
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Paul Jarc <prj@po.cwru.edu>
Date: 1999/10/14 Raw View
Chris Torek <torek@elf.bsdi.com> writes:
> Instead of:
>
> "Hello world\n"
>
> users of ASCII-based systems can simply write:
>
> "\x48\x65\x6c\x6c\x6f\x20\x77\x6f\x72\x6c\x64\xa"
But what about character sets that don't have 'x'? :)
paul
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Chris Torek <torek@elf.bsdi.com>
Date: 1999/10/14 Raw View
(I realise this thread is old and probably should be left dead, but
I cannot resist... the moderator(s) of comp.std.c++ should feel free
to toss this. :-) )
In article <37E7D426.398BD5FD@ix.netcom.com> "Paul D. DeRocco"
<pderocco@ix.netcom.com> writes:
>>If I need to talk to a physical device that uses ASCII
>>ESC to introduce escape sequences, and I want the program to be portable to
>>an EBCDIC machine, which has an EBCDIC to ASCII translator somewhere
>>between the program and the device,
In article <7sar95$kdn$1@panix3.panix.com> Greg Comeau
<comeau@comeaucomputing.com> writes:
>If the above is so (you have such a translator), then why is this so:
>
>>then I need \e because I cannot blithely include \x1B in the code.
>
>Your saying you don't care about portability and you'll be getting
>\x1B anyway, no?
(Of course, the actual answer is that the translator only translates
EBCDIC to ASCII, so it needs an EBCDIC escape: \x27.)
"\e" is clearly nonportable and does not exist in some character
sets. However, the same is true for other graphics. Indeed, in
some encodings, many members of the ASCII set display as some other
character entirely (such as a Cyrillic letter). I therefore make
the following modest proposal:
Let us remove *all* characters from strings except for octal and
hexadecimal encodings. Instead of:
"Hello world\n"
users of ASCII-based systems can simply write:
"\x48\x65\x6c\x6c\x6f\x20\x77\x6f\x72\x6c\x64\xa"
Some may object that this is ugly, but as others have noted, for
getting an ASCII escape,
#define ESC "\x1b"
works fine. Thus, for "pretty" coding, users who want the string
"Hello world\n" can simply write:
#define H "\x48"
#define e "\x65"
#define l "\x6c"
...
H e l l o BLANK w o r l d NEWLINE
Clearly, if "\e" is so abhorrent, so should be all the letters;
and this would be vast improvement upon the state of things.
* * *
(If you still have not figured it out, hint: Swift; giveaway: satire.)
--
In-Real-Life: Chris Torek, Berkeley Software Design Inc
El Cerrito, CA Domain: torek@bsdi.com +1 510 234 3167
http://claw.bsdi.com/torek/ (not always up) I report spam to abuse@.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]