
21st Century C (new book) - sea6ear
http://www.amazon.com/21st-Century-Tips-New-School/dp/1449327141/ref=sr_1_1?ie=UTF8&qid=1353079717&sr=8-1&keywords=21st+century+c
======
meaty
I was excited until I saw "use autotools".

 _edit_ just bought it.

Quick scan reveals some GNU extensions being used, lots of tripe about pkg-
config, autotools, how to write a makefile properly without autoconf
(commendable), gdb tutorial (looks resonable), short valgrind mention, unit
testing, doxygen, proper assertions (woot!), short bit on VCS with git (looks
reasonable), integration with python (looks reasonable), decent discussion on
aliasing and copying, some serious standard-breaking things (bad), how not too
shoot yourself with macros (good), linking discussion (looks ok), an odd quote
from pussy riot, lots of discussion of gotchas, unicode (good!), some stuff to
do with glib (yuck), OOP in C (looks ok), more glib stuff (yuck), posix
threading (some mines in there), GSL (good), SQLite (good), libxml (yuck -
personal preference though), libcurl (good).

So generally a mix of good and bad. Probably worth it though.

~~~
cobrausn
I wonder why the author decided integrating with python was a better idea
than, say, lua. Seems to me that lua is winning that fight, but that's just my
current impression - I don't really have any solid numbers to back that up.

~~~
law
How mature is string manipulation in Lua? Personally, I use python for
_anything_ involving string manipulation, and then use C or C++ (depending on
context) to do significant data processing on the (now hashed) data.

~~~
timknauf
Lua's core string manipulation has been kept (as I understand it) deliberately
limited in order to keep the implementation simple. What is present - e.g.,
simplified pattern-matching - is cleverly designed and often useful but, by
design, there's nothing to compare to Python's rich built-in set of libraries.

------
acangiano
Sorry for the shameless plug, but to discover books like this people can use
my project, <http://anynewbooks.com>. If you subscribe to the category
Programming, either via feed or via email, you'll definitely learn about new
gems coming out. For example, 21st Century C was picked as the Staff Pick for
the Programming category last week.

~~~
siodine
Please implement RSS.

~~~
acangiano
<http://anynewbooks.com/category/programming/feed/>

------
Jach
Looks potentially interesting, though I think I'd still recommend Zed's _Learn
C the Hard Way_ instead. <http://c.learncodethehardway.org/book/> Zed's book
is supposed to be a "beginner" book but it sure does cover a lot...

~~~
meaty
+1 for Zed's book. I wish he'd finish it though :)

------
chanux
On O'reilly - ebooks minus the DRM -
<http://shop.oreilly.com/product/0636920025108.do>

~~~
fusiongyro
For an extra $10.

~~~
ConstantineXVI
Which gets you guaranteed platform independence (as well as the PDF edition,
if you want the print-like layout). Fair price for some.

~~~
ansible
And O'Reilly gives you free updates forever. And if you subscribe to their
newsletter, you'll occasionally see 50% off promo codes. This HN posting was
particularly ill-timed, they had a promo code for this particular book that
expired on Nov 13th.

~~~
ConstantineXVI
Amazon does provide updates as well; not sure if O'Reilly offers this for
their Amazon "prints" (I'm sure they would, but I usually opt for direct so
unable to confirm), but I have received mails telling me my Kindle books have
been updated.

------
pav3l
I just ordered it 2 days ago directly from O'Reilly website (they currently
have "buy 2 get 1 free" promotion, just use code OPC10,
<http://shop.oreilly.com/product/0636920025108.do>). Really excited to read it
when it comes. In case you're curious the other 2 books I ordered were "Python
for Data Analysis" and "JavaScript Web Applications" which also look very
promising.

Edit: Sorry, not a referral link.

~~~
acangiano
Actually this doesn't appear to be a referral link (e.g., an affiliate link).

[http://www.amazon.com/21st-Century-Tips-New-
School/dp/144932...](http://www.amazon.com/21st-Century-Tips-New-
School/dp/1449327141/ref=sr_1_1?ie=UTF8&qid=1353079717&sr=8-1&keywords=21st+century+c)

There is no associate tag.

------
cperciva
_Use Autotools, C’s de facto cross-platform package manager_

Seriously? There is a world outside of GNU...

~~~
shin_lao
CMake for example, is IHMO, a better choice.

~~~
cperciva
Different tools for different tasks. Autotools is horrible, but there are
times when it is less horrible than any other options. The same is probably
true of CMake.

Personally, I stick to POSIX make for most of my code -- and handle cross-
platform issues by assuming POSIX compliance and telling people to fix their
damn OSes if they're not POSIX compliant.

~~~
kstenerud
Yeah, that's right! Blame the user! That'll teach 'em!

~~~
jlgreco
Frankly, depending on the nature of the product, that is the best option.

Projects with small teams who have programmers as audiences can reasonably
target POSIX and let their users work out their personal issues themselves. If
they are using something particularly weird, that is their own damn fault and
they should take responsibility for that. If not, chances are they won't have
a problem.

Running HP-UX with a GNU Hurd kernel on your toaster? Fix it yourself. Sure,
I'm sure autotools could cover that situation, but seriously, just fix it
yourself.

~~~
kstenerud
It's fine to have a limit to what you'll support, but please lose the
arrogance and condescension. A user's choice of OS is made based on a number
of concerns, some of which he has no control over. Disparaging his choice or
saying it's their own damn fault or "fix it yourself" is incredibly rude,
especially when you can tactfully say "We currently support the following
systems:" or "We currently only support systems that can run autotools, which
includes the following popular operating systems:" and maybe even add "Code
contributions to expand support are of course welcome!"

That's a damn sight nicer than "but seriously, just fix it yourself."

~~~
jlgreco
Sorry, the 'arrogance/condescension' comes from the remembered horror of
having to deal with autotools too many times. Repeatedly among the most
unpleasant experiences with technology I've ever had.

I don't think it is fair to accuse me of "blaming the user", as though that
were horrific and plainly wrong, just because I want nothing to do with that
nonsense again.

~~~
kstenerud
"Sorry, the 'arrogance/condescension' comes from the remembered horror of
having to deal with autotools too many times."

That is a valid feeling, but it does not excuse arrogant or condescending
behavior. It's not the user's fault that you've had these experiences; you
just ended up working with a painful tool. Moving on and refusing to work with
it again is perfectly fine. Blaming the users for your misery is not.

"I don't think it is fair to accuse me of "blaming the user", as though that
were horrific and plainly wrong, just because I want nothing to do with that
nonsense again."

I accused you of blaming the user because of comments such as "If they are
using something particularly weird, that is their own damn fault"

Separate the problem from the people, because the people you're attacking are
not responsible for your pain.

~~~
jlgreco
I apologize if my tone has particularly bothered you, but I don't think that I
have done anybody any harm. I'm not going to apologize for it any more than
that.

Anyway, I think we have misunderstood each other.

> _"I accused you of blaming the user because of comments such as "If they are
> using something particularly weird, that is their own damn fault""_

I agree with you there. I _am_ blaming the user.

Where we differ is that I have, with admittedly strong words, objected to the
implication that blaming the user is inherently wrong or bad to do.

There is a certain amount of work I am willing do to for the sake of the user
with use-cases dissimilar to my own. If I'm on linux, and inotify seems like
the best too for the job, I'll either abstain from using it, or use it but
make an attempt to cover other common possibilities. I think it is my
responsibility as a developer to think of others to this degree, if I am
simultaneously not following standards and not making concessions, then I am
not being fair.

Using autotools is _way_ over that helpfulness threshold though. If that much
effort is involved then I am sorry, but I expect the user to do some legwork
themselves.

------
bsg75
Any opinions on the book? I have been away from C for about 15 years, and
would like to get back into it. This sounds like it may be a good place to
(re)start.

~~~
roco
It is not bad. It could be better and go into more depth I feel. If you are
curious, here are some things I found.

Rather damn good advice. And free like beer should be.
<http://c.learncodethehardway.org>

C grammar pocket reference. Pure cheating. Actually has the sample code on how
to use C. <http://www.amazon.co.jp/dp/4774146102>

Messing with C programs makes things easier.
<http://nostarch.com/debugging.htm>

I hate it. Mainly because the layout and design gets to me. But I can't deny
that it has good info. <http://shop.oreilly.com/product/0636920015482.do>

The next book to read after your intro to C. Actually explains how to write C
programs after you know the grammar. <http://www.amazon.co.jp/dp/4774146129>

Says object oriented C. But actually it is about using scoping in C to
organize your code. <http://www.amazon.co.jp/dp/4798121134>

Just about every way you can debug your C program.
www.amazon.co.jpdp/4774133620

Starting Linux programming. Shows how to use system calls. And make a simple
web server. <http://www.amazon.co.jp/dp/4797328355>

100 Examples of C programs. Brute force yourself into using learning C.
<http://www.amazon.co.jp/dp/4798017396>

How to use various C libraries like BLAS and Cairo in C.
<http://www.amazon.co.jp/dp/4797361204>

I know what you are saying, most of these are in Japanese. But the code is
not. And rather easy to look at the code and see what they are doing. Anyhow,
live dangerous I say. Not many books in English explain this stuff it seems.
However, if anyone has nice C related info in any language, I would be
appreciative.

~~~
mitchi
"It's only in Japanese". You realize your language is crazy-hard? I wish you
had no kanji, it would make my life easier. nihongo ga muzukashi desu...

------
drudru11
I know C well, but check out links like these on news sites occasionally.
(Just like this story)

This book reminded me of an online C tutorial that proceeded to teach C in a
_functional_ style. I don't remember if they explicitly stated it was FP when
presenting the material.

The style was really clean. The author avoided assignment as much as possible.
All variables were initialized as if they were 'let' statements. Variables
were never re-used.

I just can't find the link anywhere.

Does anybody know that web page that I'm referring to?

~~~
e12e
Not sure if I'm thinking of the same thing, but I believe Cornell's former
introduction to computer science used C and a functional style. I'm also
unable to find a description online, now.

I was handed a few lecture notes by my former professor who interned there in
the 90s or so.

edit: To clarify, I looked, but couldn't find the notes right now either. Not
sure if I still have them.

~~~
e12e
Some relevant links I _did_ find:

"The Function Pointer Tutorials": <http://www.newty.de/fpt/index.html>

"Functional C" <http://eprints.eemcs.utwente.nl/1077/>

"The C Language is Purely Functional" - a satirical, but also, thoughtful post
that I don't think has been submitted to HN before (or the search system is
rubbish):

<http://news.ycombinator.com/item?id=4800922> or:
[http://conal.net/blog/posts/the-c-language-is-purely-
functio...](http://conal.net/blog/posts/the-c-language-is-purely-functional)

------
natemartin
Looks really interesting. I mainly use C while working on embedded code, how
applicable is this book to embedded C?

If this isn't a great resource for embedded C, can anyone recommend a
different book?

------
mej10
So, I studied C in college and really enjoyed it. It really fit my style of
thinking at the time (having a mental model of what the machine is doing is
really valuable). I wrote a game in C/OpenGL, but really didn't learn much
about "modern C" or much of the ecosystem other than doxygen/make/gdb.

These days I primarily program web services and iPhone apps in Ruby,
occasionally using Java for performance issues. Is there any good reason for
me to further my C knowledge?

------
marquis
Anything similar to this for C++? We're looking for good teaching books at the
moment.

~~~
fusiongyro
The new edition of the C++ Primer is helping me quite a bit. It explicitly
notes which things are from C++11 and which aren't, and they talk quite a bit
about the new stuff.

I had tried to learn from Stroustrup before C++11 and didn't get as far.

~~~
fceccon
I'm reading C++ Primer 5/e at the moment and I'm enjoying it so far. I like
how it starts using the hight level containers before introducing other more
low-level structs. The second part is a nice overview of the C++ Library so
you won't end reinventing the wheel when writing your first programs.

Also the Kindle edition is really well done. The biggest flaw of this book is
that's huge.

~~~
fusiongyro
It would be hard to write a short introduction to C++ that didn't leave you
pretty unprepared though.

------
konstruktor
Unicode is part of the TOC. That's a good sign.

------
benihana
So I'm a web developer, as I imagine a large portion of the Hacker News
community is. I learned to program on C in college, but am interested in
learning a more proper (in the engineering sense) way of programming C. Should
I look at this book? Should I just read Zed's Learn C the Hard Way?

~~~
trippplezz
I would recommend "C: A Modern Approach", 2nd ed by King
([http://www.amazon.com/Programming-Modern-Approach-2nd-
Editio...](http://www.amazon.com/Programming-Modern-Approach-2nd-
Edition/dp/0393979504/ref=sr_1_1?ie=UTF8&qid=1353084145&sr=8-1&keywords=c+a+modern+approach))

It's a hefty tome but that's not necessarily bad if you want to (re-)learn the
language and the tricks in a proper way. Easily in my personal Top 5 books for
C (The others are in no particular order: "Pointers on C", "Expert C
Programming: Deep C Secrets", "The Standard C Library", "C Interfaces and
Implementations".)

