
































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Class: Programming UNIX; Subject: COMP Computer Science; University: University of Memphis; Term: Spring 2006;
Typology: Study notes
1 / 72
This page cannot be seen from the preview
Don't miss anything!

































































Unix programming philosophy
{
C programming tools
z
compilation
{
single-module programs {
multi-module programs
z
debugging
z
maintaining large multi-module programs
{
the unix file dependency system: make {
the unix archive system: at {
the unix source code control system: sccs
{
Chapter 12, Glass and Ables
{
Source code available: ftp://ftp.prenhall.com/pub/esm/the_apt_series.s-042/glass_ables_unix-3e/
{
A weak or nonexistent CLI can lead to problems: {
Outputs can’t be used as inputs {
Remote system access will be difficult {
Non-interactive programs (servers, daemons, and background processes) will require a GUI How do Windows/Mac OS handle these tasks? (Hint: They’re actually moving towards CLIs!)
Rule of Representation: Fold knowledge into data soprogram logic can be stupid and robust.
Rule of Least Surprise: In interface design, always do theleast surprising thing.
Rule of Silence: When a program has nothing surprising tosay, it should say nothing.
Rule of Repair: When you must fail, fail noisily and as soonas possible.
Rule of Economy: Programmer time is expensive; conserveit in preference to machine time.
Rule of Generation: Avoid hand-hacking; write programs towrite programs when you can.
Rule of Optimization: Prototype before polishing. Get itworking before you optimize it.
Rule of Diversity: Distrust all claims for “one true way”.
Rule of Extensibility: Design for the future, because it willbe here sooner than you think.
{
z
z
z
z
{
z
reverse a string
{
z
lecCh12/reversefirst.c
{
z
gcc reversefirst.c
(output file: a.out)
z
gcc reversefirst.c –o reversefirst
{
z
reversefirst
{
z
#define, #include, #ifdef
z
‘#’ must be the first non-whitespace character
{
So, the following code segment: #define
test(
f1,
f
f
f
x
test(6,
y
test(x,
Is preprocessed into this before compilation: x
y
x
{
{
{
{
{
z
z
{
{
{
{
{
{
{