Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!reinhard From: reinhard@samsung.com (Steven Reinhardt) Newsgroups: comp.object Subject: whining about C++ (was Re: Documenting OO Systems) Keywords: operators Message-ID: <21325@samsung.samsung.com> Date: 28 Mar 91 14:08:21 GMT References: <299@orbit.gtephx.UUCP> <1991Mar25.145441.1@happy.colorado.edu> <20106@alice.att.com> <3481@engadm3.csd.mot.com> <1991Mar26.191259.14470@i88.isc.com> <4693@osc.COM> Sender: news@samsung.COM Reply-To: reinhard@tristar.samsung.com (Steven Reinhardt) Organization: Samsung Software America, Inc. Lines: 42 In article <4693@osc.COM> jgk@osc.COM (Joe Keane) writes: >One thing i like about C is that when you type something you know what it's >going to do. There are some catches, like operator precedence isn't what it >should be in some cases. But in general when you say `a = b', you're pretty >sure what the compiler's going to do with this. > >I wish i could say the same thing about C++, but i'm afraid this is one of the >big differences between the two languages. There are a number of causes, >including inline functions, virtual inheritance, invisible copy constructors, >and i'm sure there are more. The end result is that when you say `a = b', you >have no idea what the compiler is actually going to put there. > >So you type a one-line C++ function, but when you look at the assembly version >it's 100 lines. (Long ago i gave up reading the cfront output. Compiling it >to assembler improves the readability.) This is a little distressing at >first, but finally you just have to accept that C++ is far from a WYSIWYG >language. >-- >Joe Keane, C++ hacker A hearty "amen" to that. Having just completed a serious project in C++, and having been fortunate enough to learn object-oriented programming before learning C++, I found the language frustrating for exactly this reason. In C, if you can conceive it, you can do it, with few exceptions. It can get ugly, but C is so close to machine language that when you type something, you know exactly what it's going to do. The first time I looked at the output of "g++ -S" I was amazed at how much was going on behind my back. If C++ had the power of, e.g., Smalltalk, that would be expected; you wouldn't even try to figure out what was going on at the machine level unless you were debugging the system. But it doesn't, and that's my complaint: either give me enough power in the language that I don't care exactly what instructions the CPU is executing, or give me C where I can get a pretty accurate idea from looking at the source. (And I mean looking at, say, three adjacent lines of source, not browsing header files to see what inherits form what and which functions are inline and/or virtual.) Steve