Computer Science 010
Lecture Notes 12
Customizing the Unix Environment,
Common Unix Programs,
and A Little About C++
Common Unix Programs
Let's look at some of these common Unix programs:
- latex, dvips, gv
What is C++?
It's how you increment the value of C in C, of course.
We do not have enough time to cover C++ in any depth, but here are
a few highlights of how it's different than C. C++ adds
object-orientation to C but does so in a very different way than Java
does. Many of the differences stem from the fact that C++ is
backwards compatible with C. This means that you can take a C program
and run it through a C++ compiler. It will compile and execute the
same way. You cannot run a C program through a Java compiler, even
though much of the syntax is similar.
This means that C++ suffers from all the drawbacks of C, although
it adds tools which allow you to avoid some of the pitfalls if you use
them properly. C++ does not check array lengths. It is still very
easy to misuse pointers, causing your program to crash. You need to do
your own memory deallocation.
C++ does add the following features to C:
- Classes - classes can be used to encapsulate data and
functions. From an encapsulation perspective C++ classes are quite
similar to Java classes. There are syntactic differences, however.
For example, you should declare a class in a header file and place
its body in a .cc file.
- C++ supports multiple inheritance. Java supports single
inheritance via the extends clause. Multiple inheritance allows a
class to inherit code from multiple classes. This is extremely
complicated to do right.
- C++ adds exception handling similar to Java's.
- C++ has templates, a mechanism to define a class such as set
and then instantiate the class so it only has elements of a single
type. This cannot be done in Java currently although something
like this is likely to appear in a future version of Java.
Stupid Unix Tricks: Search for "Stupid Unix Tricks" in your favorite
search engine and follow the links. Many of them are pretty old as
indicated by their poking fun at the Reagan administration, but some
are pretty good. Some no longer work since newer shell and Unix
utility versions give better error messages than they used to (yes,
Unix used to be even MORE cryptic!). But you get the idea.
Anyone want to talk about... Unix System Administration?