Regarding C and C++ (64)

1 Name: #!/usr/bin/anonymous : 2008-05-04 22:04 ID:wFp9lX0t

In which order should one learn those languages? C goes first, or C++?
Any essential advise you could give me? Books, docs, good source code?

Thanks and best regards

2 Name: #!/usr/bin/anonymous : 2008-05-04 23:02 ID:ZD8VERXJ

C++ is pretty much C with more. Just learn C++, skip C.

3 Name: #!/usr/bin/anonymous : 2008-05-04 23:42 ID:EBpV+i10

C++ is pretty much C with a lot of dumb crap. Just learn C, don't bother with C++.

4 Name: #!/usr/bin/anonymous : 2008-05-04 23:48 ID:rX0YMtxO

>>1

Hey OP. You will surely get a lot of responses or different opinions on this,

and perhaps that will get you confused. >>2 concludes that you should skip C and
learn C++, based on that C is a subset of C++. However, that is not correct. C
has a lot of differences with C++, which are sometimes quite subtle. You will
find a wonderful page that explains all this here:
<a href="http://david.tribble.com/text/cdiffs.htm">Incompabilities between ISO C and ISO C++</a>
All these are too advanced for you, but just looking at the size of that page,
you can be sure that >>2 is wrong. That, however, does not mean that learning
C++ before C is wrong.

My suggestion is that you go with C first. C is a lot smaller than C++, so

you'll get to completely understand what happends in a C program a lot faster. C
is also more "stable". There's a new C++ standard coming out around 2009. If you
don't know what a standard is, it's okay. Just understand that what you might
learn now about C++ you might have to re-learn in 2009. By 2009, if you take the
C path, you should be a good C programmer, <i>if</i> you follow my advice on
what books to pick and read. Generally, learning either language is no easy
task. Learning a language doesn't mean to be able to write 10 or 20 lines of
code in it. It means to be able to read any code and being able to tell what
happends in every line. Not what the programmer intented to do, but what the
compiler will understand. There's <i>too</i> many C programmers out there that
don't really know C. At all. Which is sad, do not end up like them. Every time
you wonder whether you at last know C or not, ask yourself this:
<i>Do I know most of what's written in ISO 9899:1999?</i>
If you can, then you do. When that time comes, it's up to you to learn C++.

As for the advice, here's my advice:

Obviously go with C. Get books such as K&R - The C programming language, or H&S
C: a reference manual 5th edition. Read them, do the exercises, be patient. It
should take at least 6 months to learn C. When and if you feel like completely
mastering the language, click the third link, and get the C99 standard,
available for free in pdf form (should be called WG14 N1124).

<a href="http://cm.bell-labs.com/cm/cs/cbook/">The C programming language</a>
<a href="http://careferencemanual.com/">C: A reference manual</a>
<a href="http://www.open-std.org/jtc1/sc22/wg14/">ISO/IEC JTC1/SC22/WG14</a>

P.S. Don't give up. When this journey comes to its end a lot of doors will

open, you'll be able to read about most concepts around computers.

5 Name: #!/usr/bin/anonymous : 2008-05-04 23:50 ID:Heaven

>>4
Sorry, I forgot HTML. Here's how the message should've appeared:

Hey OP. You will surely get a lot of responses or different opinions on this,
and perhaps that will get you confused. >>2 concludes that you should skip C and
learn C++, based on that C is a subset of C++. However, that is not correct. C
has a lot of differences with C++, which are sometimes quite subtle. You will
find a wonderful page that explains all this here:
Incompabilities between ISO C and ISO C++
All these are too advanced for you, but just looking at the size of that page,
you can be sure that >>2 is wrong. That, however, does not mean that learning
C++ before C is wrong.

My suggestion is that you go with C first. C is a lot smaller than C++, so
you'll get to completely understand what happends in a C program a lot faster. C
is also more "stable". There's a new C++ standard coming out around 2009. If you
don't know what a standard is, it's okay. Just understand that what you might
learn now about C++ you might have to re-learn in 2009. By 2009, if you take the
C path, you should be a good C programmer, if you follow my advice on
what books to pick and read. Generally, learning either language is no easy
task. Learning a language doesn't mean to be able to write 10 or 20 lines of
code in it. It means to be able to read any code and being able to tell what
happends in every line. Not what the programmer intented to do, but what the
compiler will understand. There's too many C programmers out there that
don't really know C. At all. Which is sad, do not end up like them. Every time
you wonder whether you at last know C or not, ask yourself this:
Do I know most of what's written in ISO 9899:1999?
If you can, then you do. When that time comes, it's up to you to learn C++.

As for the advice, here's my advice:
Obviously go with C. Get books such as K&R - The C programming language, or H&S
C: a reference manual 5th edition. Read them, do the exercises, be patient. It
should take at least 6 months to learn C. When and if you feel like completely
mastering the language, click the third link, and get the C99 standard,
available for free in pdf form (should be called WG14 N1124).

The C programming language
C: A reference manual
ISO/IEC JTC1/SC22/WG14

P.S. Don't give up. When this journey comes to its end a lot of doors will
open, you'll be able to read about most concepts around computers.

6 Name: #!/usr/bin/anonymous : 2008-05-05 00:16 ID:Heaven

go with c. c++ was built for large-scale heavy duty apps involving many programmers. everything thats in c++ not in c serves that purpose.
programming in c by kochan is a great book.

7 Name: #!/usr/bin/anonymous : 2008-05-05 00:26 ID:rX0YMtxO

Just how the hell can I compile scheme or common lisp to actual executables?

8 Name: #!/usr/bin/anonymous : 2008-05-05 00:41 ID:Q5bXlgbg

>>7 Depends on the compiler, becuase that particular feature isn't standardized.

In SBCL you use:

(sb-ext:save-lisp-and-die "filename" :executable t)

In ECL you use:

(c::build-program "filename"
:lisp-files (list (compile-file-pathname "file.lisp" :type :object)))

In MZScheme you can use "mzc" to compile:

mzc --prim --exe src.ss

9 Name: #!/usr/bin/anonymous : 2008-05-05 00:44 ID:Heaven

Lispworks has a special "application builder" which not only compiles but prepares the application for distribution by removing definitions that aren't used. I think ACL has something similar.

The reason this "feature" isn't easy to figure out is because it isn't a normal part of Lisp application development. The fact that you're trying to figure this out first lends itself to the idea you're trying to figure out how to Lisp using your C/C++ knowledge. You probably want a build procedure kindof like C/C++ where you "build" your application as a separate state from developing it.

Don't do that. By the time you have an application you want to deliver in exe-form to other people, it'll be a lot easier to explain. Waste your time trying to figure this out now and you're just going to frustrate yourself needlessly, and you're going to avoid "getting" some of the most useful aspects of Lisp programming.

10 Name: 7 : 2008-05-05 00:48 ID:Heaven

>>8,9
That post >>7 was for http://4-ch.net/code/kareha.pl/1209513777 this thread. Sorry

11 Name: #!/usr/bin/anonymous : 2008-05-05 12:18 ID:kyJ8Nbmx

>>5
Thank you very much for your informing reply.

12 Name: #!/usr/bin/anonymous : 2008-05-07 08:48 ID:Heaven

>>1

Let C kick your ass for a good amount of time before moving over to any object oriented languages

13 Name: #!/usr/bin/anonymous : 2008-05-08 14:34 ID:TfePZxUZ

OP here, I checked few C books and "The C Programming Language" was the most unclear one. I learned the basics of C before, but never beyond them, and the book I mentioned above looks more like a style guide, having the ANSI C code in it. Should I stick to this book though I don't get it, or continue through another, not ANSI C but more clear ones? I can always go back to it after I learned a fair amount to improve my coding style.

Thanks again

14 Name: #!/usr/bin/anonymous : 2008-05-08 19:22 ID:Heaven

FUCK YOU 4-CH.NET.
I WROTE THIS GOD DAMN HUGE REPLY TO OP AND WHAT DO I GET IN REPLY?
MY COMMENT WAS TOO LONG BY 1200 CHARACTERS. BECAUSE I WROTE THIS WITH w3m
NOW I HAVE TO REWRITE IT. NO. FUCK YOU 4-CH, FUCK YOU.

This thread has been closed. You cannot post in this thread any longer.