C++ Compiling Problems

John Summerfied debian at herakles.homelinux.org
Tue May 24 09:36:57 UTC 2005

Matthew Miller wrote:
> On Mon, May 23, 2005 at 10:07:42PM +0800, John Summerfied wrote:
>>>Brian Kernighan and Dennis Ritchie. As I said before, C is an elegant and
>>>small language, and this book is all you need. (Although you may also want
>>>to pick up The UNIX Programming Environment by Kernighan and Rob Pike.)
>>K&R C is no longer current, and I think it will give gcc severe heartburn.
> As mentioned before, the updated second edition is ANSI C. That's not C99,
> but gcc will be completely happy.
>>There are altogether too many mistakes a C programmer can make that will 
>>give rise to all sorts of program bugs including buffer overruns, 
>>pointer overruns and underruns and many more.
> Same with C++. *shrug*.
>>There are uses for C; it was originally designed for programming 
>>operating systems and such, and really is not well-suited at a 
>>general-purpose programming language.
>>The act you _can_ write almost any program you can conceive in C doesn't 
>>mean you should do so.
> The fact that you *can* write bad programs doesn't mean you shouldn't learn
> a programming language.

The fact it's so hard to write correct programs makes it a poor 
beginners' language.
>>C doesn't do strings.
>>C doesn't do fixed-point.
>>Both are needed in business applications.
> "Doesn't do" isn't correct at all. "Doesn't have as a language feature" is
> better. And of course, C *does* have strings of a sort.

It has arrays of characters, and the onus is entirely on the coder to 
choose appropriate functions, to keep track of string lengths, to test 
pointers and so on.

COBOL and PL/1 which I've used most do have strings. Proper strings. So 
does Pascal, and (Borland) Pascal does make serious efforts to help 
programmers write good safe programs.

> Anyway, with open source, there are good libraries out there to do both.

If they are not standard parts of the language many programmers will not 
find them or will choose to not use them to aid portability of their code.

>>C++ is another matter altogether, and provided programmers use the C++ 
>>features, code written in C++ is likely to be more reliable than 
>>equivalent code written by equivalently-capable C programmers.
> It's not *all* altogether a different matter, but generally, yeah, this is
             ^^^ I did qualify my statement.
> why I advise getting a good book that teachs C++ as an object-oriented
> langauge from the ground up rather than as a stepping-stone from C.



-- spambait
1aaaaaaa at computerdatasafe.com.au  Z1aaaaaaa at computerdatasafe.com.au
Tourist pics http://portgeographe.environmentaldisasters.cds.merseine.nu/

More information about the users mailing list