Clan x86

Technical (Development, Security, etc.) => General Programming => Topic started by: deadly7 on November 04, 2005, 12:12:27 am

Title: [RECOMMENDATION] C Book
Post by: deadly7 on November 04, 2005, 12:12:27 am
Currently I'm reading "C Primer Plus", but I was wondering what books you guys would recommend, since some of you have been programming in C for a few years, as opposed to a few days.
Title: Re: [RECOMMENDATION] C Book
Post by: Quik on November 04, 2005, 01:09:59 am
It depends what type of programming you're wanting to look at. I have a feeling that's a requirement before tmp recommends anything.

I think The C Programming Language by Brian W. Kernighan and Dennis M. Ritchie is worth a look.
Title: Re: [RECOMMENDATION] C Book
Post by: deadly7 on November 04, 2005, 01:11:13 am
Well right now, I'm just looking for the general scope on C.. after I get that much, I'll start to think about some projects I want to do. I already have a couple (a Gaim plugin being one of  them) that I have in mind, but obviously lack the talent.
Title: Re: [RECOMMENDATION] C Book
Post by: trust on November 04, 2005, 06:14:44 am
C++ How to Program (Not C, but eh) by Deitel & Deitel. DarkVirus recommended that to me about a year ago. I have an old version of the book, and some other C books if you'd want to (probably not though) buy from me. :P
Title: Re: [RECOMMENDATION] C Book
Post by: Joe on November 04, 2005, 07:47:43 am
<TehServer> !eBooks 0134436989 [Prentice Hall PTR] (Bil Lewis) Threads Primer - A Guide to Multithreaded Programming.pdf

Multithreading. Hm.
Title: Re: [RECOMMENDATION] C Book
Post by: iago on November 04, 2005, 08:43:07 am
Multithreaded programming in C (on Linux) is easy++.  On Windows, it's painful. 

Incidentally, if his goal is to program a Gaim plugin, I don't recommend learning C++.  It's better to learn C anyway. 

A book that I'd recommend is Programming Pearls.  I forget the author, but can dig it up if necessary.  It doesn't teach you the language, but it does teach you some nice tricks about how to program well.
Title: Re: [RECOMMENDATION] C Book
Post by: deadly7 on November 04, 2005, 12:11:21 pm
C++ How to Program (Not C, but eh) by Deitel & Deitel. DarkVirus recommended that to me about a year ago. I have an old version of the book, and some other C books if you'd want to (probably not though) buy from me. :P
What other C books do you have?

<TehServer> !eBooks 0134436989 [Prentice Hall PTR] (Bil Lewis) Threads Primer - A Guide to Multithreaded Programming.pdf

Multithreading. Hm.
eBooks = lame.

Multithreaded programming in C (on Linux) is easy++. On Windows, it's painful.

Incidentally, if his goal is to program a Gaim plugin, I don't recommend learning C++. It's better to learn C anyway.

A book that I'd recommend is Programming Pearls. I forget the author, but can dig it up if necessary. It doesn't teach you the language, but it does teach you some nice tricks about how to program well.
We went over advantages/disadvantages of C and C++ in the last thread I made in this forum, which is why I kept the book.

Hm, Programming Pearls.. I'll look around trying to find it. Thanks.
Title: Re: [RECOMMENDATION] C Book
Post by: MyndFyre on November 04, 2005, 12:35:35 pm
I liked C for Dummies, both vols.  Good times! :D
Title: Re: [RECOMMENDATION] C Book
Post by: deadly7 on November 04, 2005, 01:58:49 pm
I liked C for Dummies, both vols. Good times! :D
Gross, I hate * For Dummies.

(MF: Fixed BBC)

Title: Re: [RECOMMENDATION] C Book
Post by: Warrior on November 04, 2005, 03:59:37 pm
C++ for dummies is a great book. Try it.

Learn C first, C++ offers useless OOP garbage ontop of C and often makes the programmer
forget how to use practical solutions instead of complicating a simple task. Later once
you grasp C learn C++ to extend C.
Title: Re: [RECOMMENDATION] C Book
Post by: Joe on November 04, 2005, 05:05:12 pm
Quote
eBooks = lame.

eBooks = free.
Books = expensive.

Code: [Select]
if(like(eBook) == true) {
  eBook.buy;
}else{
  eBook.trash;
}

You know C, I'm sure you can figure out what that means.

See if its worth anything first, before going out and buying it.
Title: Re: [RECOMMENDATION] C Book
Post by: MyndFyre on November 04, 2005, 05:16:19 pm
Code: [Select]
if(like(eBook) == true) {
  eBook.buy;
}else{
  eBook.trash;
}

Code: [Select]
c:\Documents and Settings\robp.MINNOW\My Documents\Visual Studio Projects\Testbed\Testbed\Testbed.cpp(27) : warning C4551: function call missing argument list
c:\Documents and Settings\robp.MINNOW\My Documents\Visual Studio Projects\Testbed\Testbed\Testbed.cpp(29) : warning C4551: function call missing argument list

I think warnings are entirely too forgiving.  Of course, that's why you turn on the "Treat Warnings as Errors" switch.  :)
Title: Re: [RECOMMENDATION] C Book
Post by: Warrior on November 04, 2005, 05:45:38 pm
Go to your local library, mine has tons of programming books.
Title: Re: [RECOMMENDATION] C Book
Post by: Joe on November 04, 2005, 05:52:43 pm
Warrior, congrats on living in the one town in the US with programming books. =p

MyndFyre, I'm sure you're well aware that you need to create an eBook class. =)
Title: Re: [RECOMMENDATION] C Book
Post by: iago on November 04, 2005, 05:53:31 pm
Quote
eBooks = lame.

eBooks = free.
Books = expensive.

Code: [Select]
if(like(eBook) == true) {
  eBook.buy;
}else{
  eBook.trash;
}

You know C, I'm sure you can figure out what that means.

See if its worth anything first, before going out and buying it.

You shouldn't use "true" in C, it's not standard.  TRUE is better. 

Also, you shouldn't access class members directly.  You should run functions.  But you aren't actually doing anything with your member variables, so..

Also, I much prefer physical books.  The only time I use eBooks is for textbooks that I never intend to read.
Title: Re: [RECOMMENDATION] C Book
Post by: deadly7 on November 04, 2005, 06:08:42 pm
Go to your local library, mine has tons of programming books.
The one down the block from me has a pretty poor selection of programming books, but the one on the rich side of town has tons of em.
Title: Re: [RECOMMENDATION] C Book
Post by: MyndFyre on November 04, 2005, 06:47:45 pm
You shouldn't use "true" in C, it's not standard.  TRUE is better. 
Of course that's C++.

MyndFyre, I'm sure you're well aware that you need to create an eBook class. =)
Which I already had, otherwise I would have had a plethora of other errors during compilation.

Code: [Select]
int main(void);
bool like(const book* );

class book {
public:
void buy(void) { }
void trash(void) { }
};

bool like(const book* pbook) {
return true;
}

int main()
{
book eBook;

if ( like(&eBook) == true ) {
eBook.buy;
} else {
eBook.trash;
}

return 0;
}

(There is some other stuff there, because whenever I have to compile C/++ for forum posting I check it.

c:\Documents and Settings\robp.MINNOW\My Documents\Visual Studio Projects\Testbed\Testbed\Testbed.cpp(27) : warning C4551: function call missing argument list
c:\Documents and Settings\robp.MINNOW\My Documents\Visual Studio Projects\Testbed\Testbed\Testbed.cpp(29) : warning C4551: function call missing argument list
Title: Re: [RECOMMENDATION] C Book
Post by: iago on November 04, 2005, 06:51:55 pm
You not only checked it on a different operating system, you checked it on a different compiler.  If you want to check somebody's code, you ought to at least use the same technology they're using :-P
Title: Re: [RECOMMENDATION] C Book
Post by: MyndFyre on November 04, 2005, 07:03:09 pm
You not only checked it on a different operating system, you checked it on a different compiler.  If you want to check somebody's code, you ought to at least use the same technology they're using :-P
I'll refer you to ISO/IEC 9899:TC2 (http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf) section 6.5.2.2: Function Calls.  Specifically:
Quote
1 The expression that denotes the called function78) shall have type pointer to function
returning void or returning an object type other than an array type.
(Subscript 78):
Quote
Most often, this is the result of converting an identifier that is a function designator.
Also:
Quote
A postfix expression followed by parentheses () containing a possibly empty, comma-separated
list of expressions is a function call. The postfix expression denotes the called
function. The list of expressions specifies the arguments to the function.

Joe's semantics would simply be a statement of a function-pointer expression, not an actual call to the function.  In any C you need to affix the postfix operator () to make it a valid function call.
Title: Re: [RECOMMENDATION] C Book
Post by: iago on November 04, 2005, 07:50:50 pm
You're right, it IS wrong if you assume those are functions, but I meant in general :-P

I assumed those were variables, in which case, I don't think it'll have any warnings.  Of course, it won't do anything either..
Title: Re: [RECOMMENDATION] C Book
Post by: MyndFyre on November 04, 2005, 08:25:20 pm
I assumed those were variables, in which case, I don't think it'll have any warnings.  Of course, it won't do anything either..
That would be silly; buy and trash are verbs.  They should be functions.  :P
Title: Re: [RECOMMENDATION] C Book
Post by: Joe on November 04, 2005, 08:34:30 pm
Its neither C nor C++. Its pseudo-C. You lose.

On a side note, I'd prefer a physical book too, asuming I had a million dollars (those things are not cheap, and I am broke), and a rocket (it takes a while to get to the store, whereas I can download a book in about a half hour (for big ones)).
Title: Re: [RECOMMENDATION] C Book
Post by: MyndFyre on November 04, 2005, 08:37:54 pm
Its neither C nor C++. Its pseudo-C. You lose.

On a side note, I'd prefer a physical book too, asuming I had a million dollars (those things are not cheap, and I am broke), and a rocket (it takes a while to get to the store, whereas I can download a book in about a half hour (for big ones)).
What, do you live in a city of 5 people that doesn't have a bookstore?  No wonder you use dial-up.
Title: Re: [RECOMMENDATION] C Book
Post by: Eric on November 04, 2005, 09:09:09 pm
Its neither C nor C++. Its pseudo-C. You lose.

On a side note, I'd prefer a physical book too, asuming I had a million dollars (those things are not cheap, and I am broke), and a rocket (it takes a while to get to the store, whereas I can download a book in about a half hour (for big ones)).

Buy them used... they're just books and Amazon owns any walk-in bookstore.
Title: Re: [RECOMMENDATION] C Book
Post by: Sidoh on November 04, 2005, 10:12:06 pm
I also perfer physical books, I find myself keeping my attention more easily when I'm reading something that's inked on paper as opposed to illuminated on my screen. :)
Title: Re: [RECOMMENDATION] C Book
Post by: deadly7 on November 05, 2005, 01:06:24 am
I also perfer physical books, I find myself keeping my attention more easily when I'm reading something that's inked on paper as opposed to illuminated on my screen. :)
Not to mention it's MUCH easier on the eyes, and you can sit with your legs kicked back and a lemonade in your other hand.
Title: Re: [RECOMMENDATION] C Book
Post by: Warrior on November 05, 2005, 01:23:13 am
You don't have a desk..? I eat, sleep, and shower @ my computer.
Title: Re: [RECOMMENDATION] C Book
Post by: iago on November 05, 2005, 02:35:16 am
My neck gets sore if I'm in any of my office chairs for a long time (read: more than an hour or two).  I like having a recliner. 

Books aren't realy that expensive.  I've never paid more than cad$100 for a good one, including shipping. 
Title: Re: [RECOMMENDATION] C Book
Post by: rabbit on November 05, 2005, 08:02:11 am
Note to us: that's ~USD$84
Title: Re: [RECOMMENDATION] C Book
Post by: deadly7 on November 05, 2005, 11:22:26 am
Note to the majority of this forum: We don't make good money working with our government to think $84 is nothing.
Title: Re: [RECOMMENDATION] C Book
Post by: iago on November 05, 2005, 03:02:56 pm
I don't have a job right now, actually.  But $100 is only 12 hours' pay at minimum wage.  Most books aren't even that much, even. 
Title: Re: [RECOMMENDATION] C Book
Post by: Sidoh on November 05, 2005, 03:11:46 pm
I don't have a job right now, actually.  But $100 is only 12 hours' pay at minimum wage.  Most books aren't even that much, even. 

even even, huh?  Hehe, just kidding.

Books are a wonderful investment to something you take interest to.  You can take them nearly anywhere!
Title: Re: [RECOMMENDATION] C Book
Post by: Joe on November 05, 2005, 03:49:55 pm
A positive thing I have to say about physical books, when I went on vacation to Teneesee, I took my VB Language Reference book with me. When I finally got back home, I did a whole bunch of crazy stuff I learned while down there. Couldn't take an eBook very well.

@deadly: I don't like lemonade, nor for some reason feel comfortable reading in a chair, nor can I hold a book in one hand without droping it/feeling weird.
Title: Re: [RECOMMENDATION] C Book
Post by: iago on November 05, 2005, 04:06:19 pm
That was just an example.  I personally like sitting in a recliner, or laying in my bed (on back or front), laying on a couch, etc. 

The only place I DON'T like reading is in an office chair, at a desk.  Or in any rigid chair, really. 

Title: Re: [RECOMMENDATION] C Book
Post by: deadly7 on November 05, 2005, 07:03:09 pm
I don't have a job right now, actually. But $100 is only 12 hours' pay at minimum wage. Most books aren't even that much, even.
Well... you smell. (That was the best retort I could come up with)

I don't have a job right now, actually.  But $100 is only 12 hours' pay at minimum wage.  Most books aren't even that much, even. 

even even, huh? Hehe, just kidding.

Books are a wonderful investment to something you take interest to. You can take them nearly anywhere!
Lies, you can take them everywhere. I was reading Hp6 in the crapper! (actually, i wasn't. I don't unsanitize my books, eww)

A positive thing I have to say about physical books, when I went on vacation to Teneesee, I took my VB Language Reference book with me. When I finally got back home, I did a whole bunch of crazy stuff I learned while down there. Couldn't take an eBook very well.

@deadly: I don't like lemonade, nor for some reason feel comfortable reading in a chair, nor can I hold a book in one hand without droping it/feeling weird.
Well, you suck so yeah. :P