From: ········@bayou.uh.edu
Subject: Re: C++ briar patch (Was: Object IDs are bad)
Date: 
Message-ID: <5lasr0$h7k$3@Masala.CC.UH.EDU>
Andrew Koenig (···@research.att.com) wrote:
: In article <······················@Alcatel.com.au> ·············@Alcatel.com.au writes:

[Snip]

: > String foo("abc\0def");

: > will produce a string of 3 characters instead of the correct 7
: > characters. It doesn't matter which "String" class you use. This is an
: > example of the core language being broken.

: It is an example of a minor inconvenience that is there for C compatibility.

I'd hardly call a crippled implementation of "strings" minor.  Of course
this is a prime example of "flawed by design".  It's sad to think
that Bjarne probably knew better, but had to keep this ridiculous
limitation just to maintain compatability with the mother of all
legacy languages.


: There is no particular difficulty in writing a string library in C++ that
: can handle arbitrary characters, and in fact the standard C++ library will
: have just such a string class.  However, C++ did not change the C syntax
: for string literals.  That means that if you want to use a literal to initialize
: a string, and you want that literal to contain any null characters, you
: have to give a length explicitly so that the library won't use the first
: null character that it finds as a sentinel.  In other words:

: 	string foo("abc\0def", 7);

That's nice, but for one little thing.  It's not natural.  Now
we've got yet another layer of swill to contend with.  "xxx" does
not denote a string, there's a class for that.  So what is "xxx"?
Well it's an array of characters.  Gee, why can't we use "xxx" for
real strings?  Because it's reserved?  Why?  Backwards compatability.
Strong emphasis on the BACKWARDS.


: or, if you don't want to have to count characters by hand:

: 	char foo_init[] = "abc\0def";
: 	string foo(foo_init, sizeof(foo_init)-1);

: where the `-1' compensates for the second \0 that C compatibility requires.

Yet another miserable hack.  This is pathetic, not only does C++ not
provide _BASIC_ functionality that any self respecting language
has always provided, but when it is changed to catch up with where
other languages were _DECADES_ ago, it ends up convoluting things
even further.  

Visualize the tower of Babylon, built up with toothpicks and held together
by phlegm.  That is C++.  When a wind comes, it collapses into a
disgusting mess.  That's C++ after somebody tries to write something
other than "hello world" in it.  After the wind, the workers rebuild
the tower using more toothpicks and more phlegm and for support add
an extra ring of toothpicks with more phlegm.  That's C++ after
the addition of "functionality".


: -- 
: 				--Andrew Koenig
: 				  ···@research.att.com
: 				  http://www.research.att.com/info/ark

--
Cya,
Ahmed
From: Henry Baker
Subject: Re: C++ briar patch (Was: Object IDs are bad)
Date: 
Message-ID: <hbaker-1305971920200001@10.0.2.1>
In article <············@Masala.CC.UH.EDU>, ········@Bayou.UH.EDU
(········@bayou.uh.edu) wrote:

> Visualize the tower of Babylon, built up with toothpicks and held together
> by phlegm.  That is C++.  When a wind comes, it collapses into a
> disgusting mess.  That's C++ after somebody tries to write something
> other than "hello world" in it.

Perhaps C++ should be pronounced "Cee pus pus" ??    ;-) ;-)