From -1824400697134995485
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,68893a751f6881d
X-Google-Attributes: gidf78e5,public
From: Hyman Rosen <cardboard.mti.sgi.com!sgi.com!ncar.UCAR.EDU!uunet!jyacc!calumny!hymie>
Subject: Re: Re Matt Austern: .. about C++ .. all is pretty!
Date: 1997/08/04
Message-ID: <t7u3h5ub05.fsf@calumny.jyacc.com>#1/1
X-Deja-AN: 262484443
References: <01bc9345$1d940e40$d09eaec7@paul> <33D49F29.61ED@informatik.uni-stuttgart.de> <33D60D3F.167E@wizard.net> <33DC809A.1FC2@informatik.uni-stuttgart.de> <fxtafj5lscb.fsf@isolde.mti.sgi.com> <33E1EDC9.4BC8@informatik.uni-stuttgart.de>
X-Original-Date: Mon, 4 Aug 1997 17:13:46 GMT
Originator: austern@isolde.mti.sgi.com
Organization: JYACC, Inc.
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUBM+Y4Pky4NqrwXLNJAQF/QAIArGT/SdHAzFcAhtAaP1aJvvkvlAbihOwI PGM1cbLAEY4WnkewUvogrpluH8FFiny7Q8lxJFJlxKRNwBONFFx0xQ== =Ltre
Newsgroups: comp.std.c++


Heinz Kohl <kohl@informatik.uni-stuttgart.de> writes:
> But today i've fallen into a one of the usual silly pitfalls in C++:
> typedef char x[40]; .. class z ..{ x y; z(x p) { y = p; .. } .. }
> Do you see it? Naturally, y and p are totally incompatible,
> compiler resignes at this point.

This is not a silly pitfall in C++, this is a silly pitfall in C.
The type 'x' is an array. In neither C nor C++ can you pass an
array by value. Neither is an array an lvalue; you can not assign
to arrays. If you are making these kinds of errors, it's little
wonder that your code has all sorts of obscure bugs. I would advise
you to learn the language better. Also, everyone on this group will
be happy to tell you to stop using C-style arrays altogether, and
switch to string and vector.
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]



