

Ask HN: Learning C and Using Libraries - girvo

So, I&#x27;m a web developer who has lately decided to get into &quot;desktop&quot; programming, and to suck it up and finally learn C.<p>I&#x27;m coming from the web world, Ruby, PHP, Python. Each of these languages has an excellent repository for libraries -- these repos let me search for what I&#x27;m looking for, check out the matches, and decide what I should use; either through a web interface or the command-line tool of choice.<p>C is fun to learn, but I&#x27;m basically just searching for &quot;&lt;functionality&gt; C library&quot; in Google, and hoping for the best. Surely there is a better way?<p>I&#x27;m developing on Linux and Mac (I use homebrew). I  know that a lot of libraries can be pulled in through apt or similar, but they don&#x27;t seem to have the same breadth or focus that the other languages have.<p>What am I missing? Or is it merely a case of myself having the wrong mindset perhaps?
======
JoachimSchipper
Yes, Google is your friend, basically. That said, there are various libraries
that implement a lot of generic, useful functionality. E.g. glib for data
structures in a desktop application, libevent/libev/libuv for event-based
programming, libpcre for regular expressions, various string libraries,
SAMBA's libtalloc for a different take on memory management, etc.

What are you trying to do?

------
NAFV_P
I'm learning ye ol' C as well. I usually concentrate on pure C, and try not to
rely too much on libs. But your post got me thinking.

"I'm developing on Linux and Mac (I use homebrew)." I don't know about Mac,
but at least you're on Linux, I found C on Windows to be more annoying.

IMO, the ideology behind C expects you to do more of the code by yourself,
especially regarding the infrastructure. As an example, a few months ago I
typed up a program to compute the square root of two without using <math.h>.

I'm at the point where I rely less on books or stinkoverflow and read other
people's code. It might be an idea to look at what libraries other coders use.
Right now I'm snooping around github.

~~~
girvo
_> Right now I'm snooping around github._

I just spent an hour doing the same! I did see __ccan __on the front page
here, that has some great snippets in it.

 _> IMO, the ideology behind C expects you to do more of the code by yourself,
especially regarding the infrastructure._

See, I agree with you here, that's why I asked whether my mindset was wrong
perhaps. The thing is though, I come from other languages where reinventing
the wheel is seen as a really dumb idea, but perhaps in C it is the right way
to go? I'm honestly not sure!

Cheers for the reply, it made me feel less lost ;)

~~~
NAFV_P
Your welcome, I'm learning Python as well, love the bignum.

"The thing is though, I come from other languages where reinventing the wheel
is seen as a really dumb idea, but perhaps in C it is the right way to go? I'm
honestly not sure!" They often say that about assembly, and I think I may have
to pull my foot out one day and learn it.

The C programming mindset requires one to think like a machine. Very few
people are born with that skill, it has to be beaten into programmers with a
keyboard.

BTW I only started learning coding last year, but I started with C++. Did you
do the same or jump straight to C? I tend to agree more with Stallman and
Torvalds these days: "A horrible language".

