Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]



On Aug 14, 10:25 pm, Dave Angel <da...@xxxxxxxx> wrote:

Benjamin Kaplan wrote:

On Fri, Aug 14, 2009 at 12:42 PM, Douglas Alan <darkwate...@xxxxxxxxx>wrote:

P.S. Overloading "left shift" to mean "output" does indeed seem a bit
sketchy, but in 15 years of C++ programming, I've never seen it cause
any confusion or bugs.

The only reason it hasn't is because people use it in "Hello World". I bet
some newbie C++ programmers get confused the first time they see << used to
shift.

People typically get confused by a *lot* of things when they learn a
new language. I think the better metric is how people fare with a
language feature once they've grown accustomed to the language, and
how long it takes them to acquire this familiarity.

Actually, I've seen it cause confusion, because of operator precedence.  
The logical shift operators have a fairly high level priority, so
sometimes you need parentheses that aren't obvious.  Fortunately, most
of those cases make compile errors.

I've been programming in C++ so long that for me, if there's any
confusion, it's the other way around. I see "<<" or ">>" and I think I/
O. I don't immediately think shifting. Fortunately, shifting is a
pretty rare operation to actually use, which is perhaps why C++
reclaimed it for I/O.

On the other hand, you are right that the precedence of "<<" is messed
up for I/O. I've never seen a real-world case where this causes a bug
in C++ code, because the static type-checker always seems to catch the
error. In a dynamically typed language, this would be a much more
serious problem.

|>ouglas

P.S. I find it strange, however, that anyone who is not okay with
"abusing" operator overloading in this manner, wouldn't also take
umbrage at Python's overloading of "+" to work with strings and lists,
etc. Numerical addition and sequence concatenation have entirely
different semantics.
.



Relevant Pages

  • Re: Wholesome choice?
    ... need an interface with the power of a language. ... I've only been using computers for 40+ years without touch typing, ... Bugs and crashes *are* inevitable. ... And that anyone with anything but the latest version of Windows ...
    (rec.arts.sf.fandom)
  • Re: c / c++ : is it end of era ?
    ... When you start talking about "bugs in the language", ... Zero terminated strings. ... array information is never destroyed. ...
    (comp.lang.c)
  • Re: "STL from the Ground Up"
    ... language does not damn the entire language. ... The existence of bugs in one implementation... ... All five of the C++ implementations I tried: ... You just said smaller compilers are likely to have fewer bugs. ...
    (comp.programming)
  • Re: How far does an object fall during the first half second after its released?
    ... >> physicists using the English language for a jargon word for the force ... >prevent confusion with previously established concepts. ... it is those who insist on a God-given meaning of the ... the "difference between weight and mass" when we use the word weight ...
    (sci.physics)
  • Re: Letter sent to Apress with concerns about Peter Seebachs online behavior
    ... explanations that are, to put it kindly, at variance with the language ... Schildt made weren't due to the fact that implementations varied. ... "real programmer" (as in, I have a CS degree, I'm a professional ... been of the script kiddie's "let's get this done and worry about bugs ...
    (comp.lang.c)