A C tutorial

J

jacob navia

There is a C tutorial at
http://www.cs.virginia.edu/~lcc-win32
It is written to go with the compiler, available
at the same URL.

I have added quite a bit of material, and I would be
glad if people in this group give it a try and tell me if
I am saying nonsense somewhere.

Beware that I am not very orthodox, hence my tutorial
(and the associated compiler) is not just a tutorial about
ANSI C, but covers things like operator overloading and
other heresies :)

And since it is running in a specific OS, windows
programming makes for quite a lot of pages. If you
use another OS however, the first part is (almost)
straight C.

jacob
 
S

Sidney Cadot

jacob said:
There is a C tutorial at
http://www.cs.virginia.edu/~lcc-win32
It is written to go with the compiler, available
at the same URL.

I have added quite a bit of material, and I would be
glad if people in this group give it a try and tell me if
I am saying nonsense somewhere.

Beware that I am not very orthodox, hence my tutorial
(and the associated compiler) is not just a tutorial about
ANSI C, but covers things like operator overloading and
other heresies :)

This will attract some flak from this crowd. ANSI C and operator
overloading do not go together; this has little to do with zealotry or
heresy... It's more like saying: I'm writing something about soccer,
which includes a section on how to properly use a tennis racket.

If you're going to do a tutorial on C++, why not simply call it a C++
tutorial?
And since it is running in a specific OS, windows
programming makes for quite a lot of pages. If you
use another OS however, the first part is (almost)
straight C.

Unfortunately, the ftp server seems to be overloaded.

Best regards, Sidney
 
J

jacob navia

Sidney Cadot said:
jacob navia wrote:
This will attract some flak from this crowd. ANSI C and operator
overloading do not go together; this has little to do with zealotry or
heresy... It's more like saying: I'm writing something about soccer,
which includes a section on how to properly use a tennis racket.

The implementation is 100% compatible with the standard. As
you may know, the standard doesn't forbid extensions.
If you're going to do a tutorial on C++, why not simply call it a C++
tutorial?

Because is C. No object oriented programming, no namespaces
no facets, no complexity. Just a few ideas from C++.
Unfortunately, the ftp server seems to be overloaded.

Yes, there are many people using it, I hope it is useful.
Just try again later.
Best regards, Sidney

Thanks
jacob
 
A

Arthur J. O'Dwyer

This will attract some flak from this crowd. ANSI C and operator
overloading do not go together; this has little to do with zealotry or
heresy... It's more like saying: I'm writing something about soccer,
which includes a section on how to properly use a tennis racket.

But as I understand it, Jacob *does* play soccer with a tennis
racket... :)

Re the actual content, I gave it a very cursory inspection. The
text still has a higher-than-average number of typos (capitalize
"Linux," for example, and the diagram on page 4, besides being
slightly mis-laid-out with respect to the surrounding text, has
a typo in the compiler message itself ("sucessfully"?)).
The technical content of the text is so lcc-win32 specific as to
make any review by comp.lang.c essentially pointless. From an ISO
Standard point of view, you've got errors up the wazoo -- but as
far as I can tell, at least the first few dozen pages are correct
from an lcc-win32 point of view.
I will also say that the typography needs some work. It's legible,
but you haven't paid much attention to the consistent use of Courier
for code snippets embedded in the text, the difference between ` and '
and whatever TeX does with ", `` and '', and lots of other little
typographical nits. Makes it somewhat more annoying to read than it
really has to be, IMHO.

my $.02,
-Arthur
 
B

Bubba

The implementation is 100% compatible with the standard. As
you may know, the standard doesn't forbid extensions.


Because is C. No object oriented programming, no namespaces
no facets, no complexity. Just a few ideas from C++.

Then it isn't C. The code may be C++, which happens to have a lot in
common with C (though it is not truly a superset)
Operator overloading is without a doubt NOT ISO/ANSI C.

So you're telling me that just because a program does not use class,
namespace, or templates means its not C++. I think you have flawed
reasoning.

I dare you to go to comp.lang.c++ and proclaim the following is not a C++
program:

int main()
{
}

Sorry, but your tutorial uses C++. It may use a restricted subset of C++,
but it is still C++, not C.

Got it?
 
A

Arthur J. O'Dwyer

Then it isn't C. The code may be C++, which happens to have a lot in
common with C (though it is not truly a superset)
Operator overloading is without a doubt NOT ISO/ANSI C.

So you're telling me that just because a program does not use class,
namespace, or templates means its not C++. I think you have flawed
reasoning.
Sorry, but your tutorial uses C++. It may use a restricted subset of C++,
but it is still C++, not C.

Got it?

You are mistaken. Jacob Navia's compiler is most definitely *NOT*
a C++ compiler, and doesn't try to be (AFAIK). It *is* a C compiler
with a whole bunch of non-standard extensions, including operator
overloading and suchlike. But it's *NOT* C++!

To use Sidney's analogy, just because Jacob likes to play soccer
using a tennis racket doesn't mean he's playing tennis. He may not
be playing tournament-rules soccer, but he's sure as heck not
playing tennis, if he's still kicking around that big black-and-white
ball!

[Jacob's an off-and-on regular in c.l.c, which is how I know what
his compiler is like, second-hand. I've never tried it myself: I
prefer to play soccer with my feet, and tennis with my tennis racket.
;-) ]

-Arthur
 
R

Richard Heathfield

jacob said:
There is a C tutorial at
http://www.cs.virginia.edu/~lcc-win32
It is written to go with the compiler, available
at the same URL.

Thanks. I'd love to have a look at it. Do you have a version available in a
portable document format? The site says that "you need the Acrobat Reader
to view it". You see, given a choice between using Acrobat Reader or not
reading your tutorial, I will cheerfully give up the chance to read your
tutorial.
 
M

Martin Ambuhl

Richard said:
jacob navia wrote:




Thanks. I'd love to have a look at it. Do you have a version available in a
portable document format? The site says that "you need the Acrobat Reader
to view it". You see, given a choice between using Acrobat Reader or not
reading your tutorial, I will cheerfully give up the chance to read your
tutorial.

What's wrong with Ghostview? Does his stuff _really_ need the Acrobat reader?
 
R

Richard Heathfield

Martin said:
What's wrong with Ghostview?

Nothing at all, of course, although I don't particularly enjoy using it. I
use it for reading the Standard, because it's in my direct interest to be
able to read the Standard as a PDF. But when I have no particular reason to
read a document other than to review it in case I can help its author to
improve it, well, call me Mr Silly but I don't think it's the author's
place to insist that I use the software /he/ chooses.

Does his stuff _really_ need the Acrobat reader?

He says it does, and he should know, shouldn't he?
 
J

Joona I Palaste

What's wrong with Ghostview? Does his stuff _really_ need the Acrobat reader?

I wouldn't be surprised if some web site authors write documents that
really _do_ require a particular (usually commercial) product to read.
Even if they don't use any proprietary features of that particular
product.

--
/-- Joona Palaste ([email protected]) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"As a boy, I often dreamed of being a baseball, but now we must go forward, not
backward, upward, not forward, and always whirling, whirling towards freedom!"
- Kang
 
J

jacob navia

Arthur J. O'Dwyer said:
Re the actual content, I gave it a very cursory inspection. The
text still has a higher-than-average number of typos (capitalize
"Linux," for example, and the diagram on page 4, besides being
slightly mis-laid-out with respect to the surrounding text, has
a typo in the compiler message itself ("sucessfully"?)).

Oooops!
The typo is not in the tutorial but in the IDE. The tutorial just
contains a screen copy.

Thanks, I corrected that immediately.
The technical content of the text is so lcc-win32 specific as to
make any review by comp.lang.c essentially pointless. From an ISO
Standard point of view, you've got errors up the wazoo -- but as
far as I can tell, at least the first few dozen pages are correct
from an lcc-win32 point of view.
I will also say that the typography needs some work. It's legible,
but you haven't paid much attention to the consistent use of Courier
for code snippets embedded in the text, the difference between ` and '
and whatever TeX does with ", `` and '', and lots of other little
typographical nits.

I didn't want to use Word, so I wrote it with Adobe Frame maker,
a very expensive and badly functioning software as I discovered
after buying it. The spell checker is inexistent almost. I will
spell check it with Word again.
Makes it somewhat more annoying to read than it
really has to be, IMHO.

my $.02,
-Arthur
Thank you for your comments
 
C

CBFalconer

Richard said:
Thanks. I'd love to have a look at it. Do you have a version
available in a portable document format? The site says that "you
need the Acrobat Reader to view it". You see, given a choice
between using Acrobat Reader or not reading your tutorial, I will
cheerfully give up the chance to read your tutorial.

What we don't know is how highly his exposition depends on
graphics. Use of pdf is clearly more portable than (ugh) word
files. Text maximizes portability and minimizes graphics. I have
found that an amalgam of html and small graphics suffices quite
nicely to handle all of KandR2 and adapts quite nicely to most
page sizes.

Meanwhile let us give M. Navia proper credit for advancing from
word files. Unfortunately he is still delivering packages in .exe
files with all the attendant security risks, and he may repair
that also in the future.
 
D

Darrell Grainger

There is a C tutorial at
http://www.cs.virginia.edu/~lcc-win32
It is written to go with the compiler, available
at the same URL.

I have added quite a bit of material, and I would be
glad if people in this group give it a try and tell me if
I am saying nonsense somewhere.

Beware that I am not very orthodox, hence my tutorial
(and the associated compiler) is not just a tutorial about
ANSI C, but covers things like operator overloading and
other heresies :)

And since it is running in a specific OS, windows
programming makes for quite a lot of pages. If you
use another OS however, the first part is (almost)
straight C.

jacob

It is not bad. It is not great but it is no worse then my old lecture
notes. The title is appropriate. You call it "Programming with lcc-win32",
which I like. The main problem I have with it is the title and first
paragraph of chapter 1.

This is not an introduction to C. It is a tutorial for lcc-win32. I have
found a lot of new programmers make assumptions when things are not clear.
Could you make the first paragraph a little more clear? For example,

"This tutorial requires the lcc-win32 compiler. It uses many extensions to
the C programming language only available to the lcc-win32 compiler. This
compiler is available free for personal use. Please download and install
it before continuing."

I find it frustrating when students think they know C programming but the
reality is that they are lost if they are not using a specific compiler
with extensions. They often have more problems in our C programming course
then students with absolutely no programming experience.

Even as someone who has been programming for 20 years, there are questions
I know to ask but did not see the answer to. Is the lcc-win32 compiler C99
compliant? Is is C89 compliant with extensions? Are there things the
extensions have broken in regards to C89 compliance?

Finally, the second paragraph of chapter 1 has the sentence "There are
other, better books that do [full-fledged introduction to all of C] (see
the bibliography at the end of this book)." This bibliography appears to
be missing.
 
J

jacob navia

Darrell Grainger said:
On Thu, 5 Feb 2004, jacob navia wrote:
[snip]
Even as someone who has been programming for 20 years, there are questions
I know to ask but did not see the answer to. Is the lcc-win32 compiler C99
compliant?
Yes

Is is C89 compliant with extensions?
Yes.

Are there things the
extensions have broken in regards to C89 compliance?
No.

Note that you can avoid any extensions by invoking the compiler with
the -ansic flag. This can be selected in the IDE by checking the
ANSI C only button in the compiler configuration tab.

So all extensions "problems" disappear.

All extensions are properly labelled as such everywhere.
Finally, the second paragraph of chapter 1 has the sentence "There are
other, better books that do [full-fledged introduction to all of C] (see
the bibliography at the end of this book)." This bibliography appears to
be missing.

Yes, Frame maker crashed and destroyed this part of the document.
I have to write it again.

jacob
 
D

Dan Pop

In said:
Thanks. I'd love to have a look at it. Do you have a version available in a
portable document format? The site says that "you need the Acrobat Reader
to view it". You see, given a choice between using Acrobat Reader or not
reading your tutorial, I will cheerfully give up the chance to read your
tutorial.

How do you read your copy of the C99 standard?

Dan
 
S

Sidney Cadot

The implementation is 100% compatible with the standard. As
you may know, the standard doesn't forbid extensions.

Ok. I assumed a couple of things from your post that were unwarranted;
it didn't help that I didn't have your document at the time.

Having extensions is of course ok, as long as you document them and they
can be disabled, which you do.

I have now downloaded your document, it looks like quite a nicely
crafted piece of work on first browsing. I agree with the other comment
that it's really a combination of a C introduction with a
compiler-specific tutorial. This is of course perfectly ok, but perhaps
you could make that a bit cleaner.

If I have some time to spare I will look into it a bit more.

Best regards, Sidney
 
D

Dan Pop

In said:
Nothing at all, of course, although I don't particularly enjoy using it. I
use it for reading the Standard, because it's in my direct interest to be
able to read the Standard as a PDF. But when I have no particular reason to
read a document other than to review it in case I can help its author to
improve it, well, call me Mr Silly but I don't think it's the author's
place to insist that I use the software /he/ chooses.

What is preventing you from using the PDF reader of your choice?

The author recommended one producing first class output, but if you
prefer ugly output instead, gv will do just fine.

Dan
 
D

Dan Pop

In said:
I wouldn't be surprised if some web site authors write documents that
really _do_ require a particular (usually commercial) product to read.
Even if they don't use any proprietary features of that particular
product.

Why would Jacob Navia want to do such a foolish thing?

His document *can* be read with open source software.

Dan
 
D

Dan Pop

The implementation is 100% compatible with the standard. As
you may know, the standard doesn't forbid extensions.

ONLY if they are in the form of assigning a well defining meaning to
program constructs that otherwise invoke undefined behaviour.

For example, you're not allowed to invade the program name space with
identifiers like WINVER and WIN32 (but _WIN32 and _WIN32_IE are OK) and

int c = operator+(a,b);

*must* be parsed as

int c = operator + (a,b);

where operator is a program defined identifier (this is a perfectly
valid C expression, BTW).

Otherwise, your compiler is not a conforming C compiler.

Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top