DaemonForums  

Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 15th December 2012
silex silex is offline
Port Guard
 
Join Date: Mar 2012
Posts: 18
Default How to become a good C programmer?

I would like to become a good C programmer, where to start or not really, where/how to begin getting better? I should probably note that I've been programming on and off since I was 7, for the last 30 years or so. I've read K&R and could program all the examples that are there. I've also read a share of C code and can understand it. It however takes me sometimes to gasp as the design gets more complex and for most part of it is not trivial to me especially compared to Python code. Is there any book to develop the upper level C skills I might use especially the design side?. Is there any reference to the best C libraries or even programs out there? Some half complex, documented C code that could lead me to an eureka or so. Where should I start or more precisely where should I begin the odyssey?
Reply With Quote
  #2   (View Single Post)  
Old 15th December 2012
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 3,318
Default

Quote:
Originally Posted by silex View Post
I would like to become a good C programmer, where to start or not really, where/how to begin getting better?
Following K&R, my personal choice is Andrew Koenig's C Traps & Pitfalls for general material. After that, studying more specific & applied topics is in order (such as any networking book by W. Richard Stevens...).

I would also recommend studying assembly language, & how to splice assembly language modules into C code. Do the same with C++ too.

Likewise, understanding programming conventions which will make the lives of maintainers easier is useful. Learning to write portable code will help develop perspective. Understanding how to write POSIX compliant code & knowing why this is important is also good to weave into your own personal style.

Lastly, study how to test code. Testing is highly underrated, & proving that implemented code does what it is supposed to do is a art most overlook.

Programming requires long periods of thoughtful study & practice. One has to understand the fundamental problem being solved, & one has to bend the language to solve that particular problem.
Quote:
Is there any reference to the best C libraries or even programs out there?
Choose one of the better Open Source projects, & study their code base. As examples, both the PostgreSQL & SQLite projects are frequently referred to having clean code which is well tested.
Reply With Quote
  #3   (View Single Post)  
Old 15th December 2012
thirdm thirdm is offline
Spam Deminer
 
Join Date: May 2009
Posts: 248
Default

Quote:
Originally Posted by ocicat View Post
Choose one of the better Open Source projects, & study their code base. As examples, both the PostgreSQL & SQLite projects are frequently referred to having clean code which is well tested.
I'm thinking the Plan 9 code would be another good exemplar. I haven't read much of it, but once saw an excerpt of driver code that looked hardly any different from the application code I'm used to dealing with. That is, I usually look at driver code and throw up my hands thinking, "no way I'll understand this anytime soon," but not with their code so much.

If you're interested in kernel programming, maybe you'd want to read the Minix source code or Lions' Commentary on UNIX 6th Edition. The latter more for the system design than the style of C used.

I remember also OpenSSH code being quite pleasant to read.
Reply With Quote
  #4   (View Single Post)  
Old 16th December 2012
rocket357's Avatar
rocket357 rocket357 is offline
Real Name: Jonathon
Wannabe OpenBSD porter
 
Join Date: Jun 2010
Location: 127.0.0.1
Posts: 429
Default

Go read the Linux kernel source. Once you've done that, I guarantee virtually any other project out there will be crystal clear in comparison.
__________________
Linux/Network-Security Engineer by Profession. OpenBSD user by choice.
Reply With Quote
  #5   (View Single Post)  
Old 16th December 2012
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,128
Default

Quote:
Originally Posted by rocket357 View Post
Go read the Linux kernel source. Once you've done that, I guarantee virtually any other project out there will be crystal clear in comparison.
Aha! No I understand why Linus does not read code anymore
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #6   (View Single Post)  
Old 16th December 2012
Mike-Sanders Mike-Sanders is offline
Fdisk Soldier
 
Join Date: Dec 2012
Posts: 52
Default

Quote:
Originally Posted by rocket357 View Post
Go read the Linux kernel source. Once you've done that, I guarantee virtually any other project out there will be crystal clear in comparison.
That bad huh? Yeah, I've read some sources as well before that were flat-out 'funky'...
__________________
www.tacoshack.xyz
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Good news for AMD-64 sharris FreeBSD General 6 12th May 2011 10:20 PM
microchip PIC Programmer? welkin FreeBSD Ports and Packages 2 1st May 2010 10:38 PM
good vi(1) tutorial ocicat General software and network 4 8th April 2010 04:12 AM
Lucky to be a Programmer ephemera Programming 1 18th July 2008 01:53 PM
Good morning all SgtHarper Feedback and Suggestions 0 9th May 2008 08:20 AM


All times are GMT. The time now is 11:22 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick