Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

Commit 9354583

Browse files
author
Brian Gough
committed
initial conversion from bzr repository
0 parents  commit 9354583

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+15217
-0
lines changed

COPYING.FDL

+397
Large diffs are not rendered by default.

Makefile.am

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
info_TEXINFOS = gccintro.texi
2+
gccintro_TEXINFOS = fdl.texi books.texi associations.texi rms.texi
3+
EXTRA_DIST = hello.c bad.c main.c hello1.h hello_fn.c main2.c c1makefile2 calc.c badpow.c dbmain.c ansi.c pi.c gnuarray.c main4.c w.c wabs.c shadow.c shadow2.c castqual.c dtest.c dtestval.c dtestval2.c dtestval3.c test.c hello.c null.c optim.c uninit.c hello.cc hellostr.cc string.cc buffer.h tprog.cc templates.cc templates2.cc alpha.c setfpu.c fptest2.c signed.c testgetc.c testgetc2.c loop.c hello_fn.c bye_fn.c hello.h main3.c collatz.c cov.c cov_c_gcov hello.c msg-file.c msg-nest1.h msg-nest2.h msg-invalidpp.c msg-cppheader.c msg-undeclared.c msg-parse.c msg-eoi.c msg-implicitdecl.c msg-unterm.c msg-string2.c msg-string2.cc msg-char.c msg-null.c msg-derefincomplete.c msg-unknownesc.c msg-assign.c msg-control.c msg-unused.c msg-const.c msg-init.c msg-ext msg-undef.c COPYING.FDL
4+
5+

NOTES

+145
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# -*- org -*-
2+
#+CATEGORY: gccintro
3+
4+
* Changes in GCC 4
5+
6+
compile time computation of constants affects quite a few examples:
7+
8+
calc.c - fixed
9+
badpow.c
10+
11+
* Updates for gcc 4.3
12+
13+
On other hand I've been testing examples of code. I'm using gcc 4.3 to do
14+
it. I've found more discrepances:
15+
16+
** TODO Page 23 I can execute ./a.out without problems.
17+
** TODO One observation in page 43 is that only when ulimit -c unlimited
18+
is executed appears the core file. Another observation, in the chapter
19+
9 the tells about the number of version, we can update it.
20+
** TODO Pag 73: with "gcc -Wall -fsigned-char signed.c doesn't appear warnings
21+
** TODO Pag 77: there are error in gcc -Wall -g loop.c, I can't execute ./a.out
22+
** DONE Pag 91: I've updated some option in ld command:
23+
ld -dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o
24+
/usr/lib/gcc/i486-linux-gnu/4.3/crtbegin.o -L/usr/lib/gcc/i486-linux-gnu/4.3
25+
hello.o -lgcc -lgcc_eh -lc /usr/lib/gcc/i486-linux-gnu/4.3/crtend.o
26+
/usr/lib/crtn.o
27+
** TODO Pag 95: I'd include the strings command in this chapter.
28+
** TODO Pag 98: I've troubles to reproduce these error messages...
29+
** DONE Pages 53, 54 the source file is optim.c instead of test.c.
30+
CLOSED: [2009-06-03 mié 14:19]
31+
** File naming scheme
32+
These are controlled by the makeexamples.pl script, maybe we need a
33+
better scheme (perhaps using some kind of annotation in the file to
34+
indicate the correct filename)
35+
*** Pag 71: exists fptest2.c instead of fptest.c
36+
*** Pag 82,83: exist main3.c instead of main.c
37+
*** Pag 76: In examples-1.1/09 doesn't exist hello.c
38+
*** Pag 95: examples-1.1/12 doesn't exist
39+
40+
* TODO Highlight important changes in release notes
41+
Another task you could do is to check all the changes in gcc-4
42+
relevant to the book.
43+
44+
They are documented in the following pages:
45+
46+
http://gcc.gnu.org/gcc-4.0/changes.html
47+
http://gcc.gnu.org/gcc-4.1/changes.html
48+
http://gcc.gnu.org/gcc-4.2/changes.html
49+
http://gcc.gnu.org/gcc-4.3/changes.html
50+
http://gcc.gnu.org/gcc-4.3/porting_to.html
51+
52+
which I've downloaded and put in the bzr repository in the changes/
53+
subdirectory.
54+
55+
! What you could do is edit the files and highlight the important
56+
! sections, e.g. by marking the start of the relevant lines (like this
57+
! paragraph). The important sections are the major new features,
58+
! changes and incompatibilities that affect the subjects covered by
59+
! the book.
60+
61+
The changes I am interested in are:
62+
63+
- EITHER a new feature of wide interest to general users and beginners
64+
- OR a change that is directly related to something in the book
65+
66+
The "Caveats" and "Other significant improvements" sections are
67+
particularly important. You can ignore a lot of stuff:
68+
69+
- The book doesn't cover java/fortran/ADA etc so these are irrelevant.
70+
- For C++ I only care if it affects something mentioned in the book
71+
(90% of changes related to the C++ language/library are therefore
72+
irrelevant)
73+
- I'm not interested interested in CPU specific changes unless
74+
specifically different from something in the book (e.g. x86
75+
floating point)
76+
77+
----------------------------------------------------------------------
78+
79+
* TODO Make a general web search for articles about GCC4 and its new features
80+
81+
Restrict the search to articles published on reputable sites like
82+
Developerworks, LWN, O'Reilly and any others you can think of.
83+
84+
Send me a list of any articles you find and also read them yourself.
85+
86+
* TODO Scan the list archives for common errors and problems
87+
Scan the archives of the gcc-help mailing list for common errors
88+
reported by users since gcc4 was released (April 2005). I'd like a
89+
list of problems of interest to beginning users not covered in the
90+
book.
91+
92+
Make a selection of months, and check all the messages in that month.
93+
There is no need to read every month. e.g. start with
94+
95+
May 2005, May 2006, May 2007, May 2008, May 2009.
96+
97+
For each month, create an entry in this file any links to the start of
98+
relevant threads and a 1-2 line description of what's interesting
99+
about it.
100+
101+
You can find the archives in various formats at:
102+
103+
http://gcc.gnu.org/ml/gcc-help/
104+
http://dir.gmane.org/gmane.comp.gcc.help
105+
106+
Note: a lot of things you can *ignore* are
107+
- GCC build/configuration issues
108+
- internal compiler errors
109+
(so there are a lot of messages you can skip).
110+
111+
----------------------------------------------------------------------
112+
113+
114+
115+
* Brian's old notes
116+
not including a header file
117+
passing an argument of the incorrect type
118+
not turning on warnings
119+
120+
not linking with the correct library
121+
122+
123+
warning: value computed is not used
124+
EXAMPLE; for (i = 0, i < 10; i++)
125+
126+
instead of for (i = 0; i < 10; i++)
127+
128+
forward.c:53: warning: assignment from incompatible pointer type
129+
130+
----------------------------------------------------------------------
131+
132+
The best article is "Get to know GCC4" (
133+
http://www.ibm.com/developerworks/linux/library/l-gcc4/index.html?S_TACT=105AGX01&S_CMP=LP).
134+
You've a summary of each release in the core changes, very useful.
135+
136+
Tree SSA: A New Optimization Infrastructure for
137+
GCC<http://gcc.fyxm.net/summit/2003/Tree%20SSA%20-%20A%20New%20optimization%20infrastructure.pdf>,
138+
Autovectorization in
139+
GCC<ftp://gcc.gnu.org/pub/gcc/summit/2004/Autovectorization.pdf>and
140+
introduction
141+
to OpenMP <http://en.wikipedia.org/wiki/OpenMP> are interesting if you are
142+
excited with Get to know GCC4.
143+
Sun Studio 12 vs. GCC3 vs. GCC4 Benchmarks (
144+
http://www.phoronix.com/scan.php?page=article&item=sun_studio_gcc&num=6) is
145+
a curious article to OpenSolaris users. Regards.

alpha.c

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <stdio.h>
2+
3+
int
4+
main (void)
5+
{
6+
double x = 1.0, y = 0.0;
7+
printf ("x/y = %g\n", x / y);
8+
return 0;
9+
}

ansi.c

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <stdio.h>
2+
3+
int
4+
main (void)
5+
{
6+
const char asm[] = "6502";
7+
printf ("the string asm is '%s'\n", asm);
8+
return 0;
9+
}

associations.texi

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
The GNU Compiler Collection is part of the GNU Project, launched in 1984
2+
to develop a complete Unix-like operating system which is free software:
3+
the GNU system.
4+
5+
The Free Software Foundation (FSF) is a tax-exempt charity that raises
6+
funds for continuing work on the GNU Project. It is dedicated to
7+
promoting the right to use, study, copy, modify, and redistribute
8+
computer programs. One of the best ways to help the development of free
9+
software is to become an associate member of the Free Software
10+
Foundation, and pay regular dues to support their efforts.
11+
12+
Associate members of the Free Software Foundation receive many benefits,
13+
including regular newsletters, admission to the FSF annual meeting, and
14+
discounts on books and CDROMs published by GNU Press. Membership dues
15+
are also tax deductible in the USA. For more information on becoming a
16+
member, visit the FSF website at @uref{http://www.fsf.org/}.
17+
18+
The Free Software Foundation Europe (FSFE) is a sister organisation of
19+
the Free Software Foundation. The FSFE is active in promoting free
20+
software at all levels in Europe. For an annual membership fee,
21+
individuals can join FSFE and support its work. Members receive a
22+
personalised GPG-compatible membership smartcard, allowing secure
23+
digital authentication of email and files, and gain access to the ``FSFE
24+
Fellowship'', an electronic community for software freedom. For more
25+
information, visit the FSFE website at @uref{http://www.fsfe.org/}.
26+
27+
The @cite{Foundation for a Free Information Infrastructure (FFII)} is
28+
another important organization in Europe. FFII is not specific to free
29+
software, but works to defend the rights of all programmers and computer
30+
users against monopolies in the field of computing, such as patents on
31+
software. For more information about FFII, or to support their work
32+
with a donation, visit their website at @uref{http://www.ffii.org/}.
33+

bad.c

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include <stdio.h>
2+
3+
int
4+
main (void)
5+
{
6+
printf ("Two plus two is %f\n", 4);
7+
return 0;
8+
}

badpow.c

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <stdio.h>
2+
3+
int
4+
main (void)
5+
{
6+
double x = pow (2.0, 3.0);
7+
printf ("Two cubed is %f\n", x);
8+
return 0;
9+
}

books.texi

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
Network Theory publishes books about free software under free
2+
documentation licenses. Our current catalogue includes the following
3+
titles:
4+
5+
@itemize @bullet
6+
@item
7+
@uref{http://www.network-theory.co.uk/diff/manual/,@cite{Comparing and Merging Files with GNU diff and patch},@cite{Comparing and Merging Files with GNU diff and patch}}
8+
by David MacKenzie, Paul Eggert, and Richard Stallman
9+
(ISBN 0-9541617-5-0) $19.95 (@pounds{}12.95)
10+
11+
@item
12+
@uref{http://www.network-theory.co.uk/cvs/manual/,@cite{Version Management with CVS},@cite{Version Management with CVS}}
13+
by Per Cederqvist et al.
14+
(ISBN 0-9541617-1-8) $29.95 (@pounds{}19.95)
15+
16+
@item
17+
@uref{http://www.network-theory.co.uk/bash/manual/,@cite{GNU Bash Reference Manual},@cite{GNU Bash Reference Manual}}
18+
by Chet Ramey and Brian Fox
19+
(ISBN 0-9541617-7-7) $29.95 (@pounds{}19.95)
20+
21+
@item
22+
@uref{http://www.network-theory.co.uk/R/manual/,@cite{An Introduction to R},@cite{An Introduction to R}}
23+
by W.N. Venables, D.M. Smith and the R Development Core Team
24+
(ISBN 0-9541617-4-2) $19.95 (@pounds{}12.95)
25+
26+
@item
27+
@uref{http://www.network-theory.co.uk/octave/manual/,@cite{GNU Octave Manual},@cite{GNU Octave Manual}}
28+
by John W. Eaton
29+
(ISBN 0-9541617-2-6) $29.99 (@pounds{}19.99)
30+
31+
@item
32+
@uref{http://www.network-theory.co.uk/gsl/manual/,@cite{GNU Scientific Library Reference Manual---Second Edition},@cite{GNU Scientific Library Reference Manual---Second Edition}}
33+
by M. Galassi, J. Davies, J. Theiler, B. Gough, G. Jungman, M. Booth, F. Rossi
34+
(ISBN 0-9541617-3-4) $39.99 (@pounds{}24.99)
35+
36+
@item
37+
@uref{http://www.network-theory.co.uk/python/manual/,@cite{An Introduction to Python},@cite{An Introduction to Python}}
38+
by Guido van Rossum and Fred L. Drake, Jr.
39+
(ISBN 0-9541617-6-9) $19.95 (@pounds{}12.95)
40+
41+
@item
42+
@uref{http://www.network-theory.co.uk/python/language/,@cite{Python Language Reference Manual},@cite{Python Language Reference Manual}}
43+
by Guido van Rossum and Fred L. Drake, Jr.
44+
(ISBN 0-9541617-8-5) $19.95 (@pounds{}12.95)
45+
46+
@item
47+
@uref{http://www.network-theory.co.uk/R/base/,@cite{The R Reference Manual---Base Package (Volume 1)},@cite{The R Reference Manual---Base Package (Volume 1)}}
48+
by the R Development Core Team
49+
(ISBN 0-9546120-0-0) $69.95 (@pounds{}39.95)
50+
51+
@item
52+
@uref{http://www.network-theory.co.uk/R/base/,@cite{The R Reference Manual---Base Package (Volume 2)},@cite{The R Reference Manual---Base Package (Volume 2)}}
53+
by the R Development Core Team
54+
(ISBN 0-9546120-1-9) $69.95 (@pounds{}39.95)
55+
@end itemize
56+
57+
@noindent
58+
All titles are available for order from bookstores worldwide.
59+
60+
@noindent
61+
Sales of the manuals fund the development of more free software and
62+
documentation.
63+
64+
@noindent
65+
For details, visit the website @uref{http://www.network-theory.co.uk/}

buffer.h

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#ifndef BUFFER_H
2+
#define BUFFER_H
3+
4+
template <class T>
5+
class Buffer
6+
{
7+
public:
8+
Buffer (unsigned int n);
9+
void insert (const T & x);
10+
T get (unsigned int k) const;
11+
private:
12+
unsigned int i;
13+
unsigned int size;
14+
T *pT;
15+
};
16+
17+
template <class T>
18+
Buffer<T>::Buffer (unsigned int n)
19+
{
20+
i = 0;
21+
size = n;
22+
pT = new T[n];
23+
};
24+
25+
template <class T>
26+
void
27+
Buffer<T>::insert (const T & x)
28+
{
29+
i = (i + 1) % size;
30+
pT[i] = x;
31+
};
32+
33+
template <class T>
34+
T
35+
Buffer<T>::get (unsigned int k) const
36+
{
37+
return pT[(i + (size - k)) % size];
38+
};
39+
40+
#endif /* BUFFER_H */

bye_fn.c

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include <stdio.h>
2+
#include "hello.h"
3+
4+
void
5+
bye (void)
6+
{
7+
printf ("Goodbye!\n");
8+
}

c1makefile2

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CC=gcc
2+
CFLAGS=-Wall
3+
main: main.o hello_fn.o
4+
5+
clean:
6+
rm -f main main.o hello_fn.o

calc.c

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include <math.h>
2+
#include <stdio.h>
3+
4+
int
5+
main (void)
6+
{
7+
double x = 2.0;
8+
double y = sqrt (x);
9+
printf ("The square root of %f is %f\n", x, y);
10+
return 0;
11+
}

castqual.c

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
void
2+
f (const char * str)
3+
{
4+
char * s = (char *)str;
5+
s[0] = '\0';
6+
}

0 commit comments

Comments
 (0)