Re: advantages of C
From: Kevin Cline (kcline17_at_hotmail.com)
Date: 01/30/04
- Next message: Yoyoma_2: "Re: Mars Rover Not Responding"
- Previous message: The Ghost In The Machine: "Re: Mars Rover Not Responding"
- In reply to: Willem: "Re: advantages of C"
- Next in thread: Willem: "Re: advantages of C"
- Reply: Willem: "Re: advantages of C"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Jan 2004 08:25:21 -0800
Willem <willem@stack.nl> wrote in message news:<slrnc0tivl.1g0f.willem@toad.stack.nl>...
> osmium wrote:
> ) The point is often made that C++ is a better C, and I agree. But I don't
> ) know of any book that one could use to learn, in a reasonable fashion, this
> ) "better C". Somewhere about chapter ten they introduce classes and the
> ) world collapses. How does the reader skip this chapter and finish reading
> ) chapters 11 though 20 without a great sense of unease?
>
> C++ is 'better' than C *because* it has classes.
And constructors and destructors and templates and exceptions and
inheritance and virtual functions and the STL and operator overloading
and ...
In C++, it's easy for me to write code that is obviously correct. In
C, life is harder. I have to manually make sure that there is a free
for every malloc, and an unlock for every lock, instead of just coding
a constructor and destructor. I have to handle error returns after
every function call, instead of handling them all together in a single
catch clause. I have to use the preprocessor, cut and paste code, or
cast to void* instead of writing template classes. I have to replace
operator expressions with function calls if I switch from a built-in
type to a user-defined type, instead of overloading those operators
for my type. I have to worry about overflowing char[] buffers,
instead of using std::string. Correctly used, C++ is a great tool for
keeping bugs out of code.
- Next message: Yoyoma_2: "Re: Mars Rover Not Responding"
- Previous message: The Ghost In The Machine: "Re: Mars Rover Not Responding"
- In reply to: Willem: "Re: advantages of C"
- Next in thread: Willem: "Re: advantages of C"
- Reply: Willem: "Re: advantages of C"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|