Helpful tools to become a really fast and good c-programmer

M

markus

Hi,

As I been programming in C I have discovered more and more tools that
really helps to speed up the development process when writing
programs. Examples of such tools are cscope, cbrowser, tags, etc.

There are ofcourse many different levels of programmers, and the
beginners might only use emacs or vi to write their code. However,
since there are such great tools out there to help the programmer, I
am wondering which tools are considered to be the best and most
effective?

In other words, what kind of tools are the "elite" programmers using?
I am sure they are not just using a simple editor..

It would be really interesting to get some opinions on which tools
speed up the development process the most. I would say that cscope
with cbrowser is the most effective tool to help the development
process, especially if there is a lot of new code to get into.

Best regards
 
C

CBFalconer

R

red floyd

markus said:
Hi,

As I been programming in C I have discovered more and more tools that
really helps to speed up the development process when writing
programs. Examples of such tools are cscope, cbrowser, tags, etc.

There are ofcourse many different levels of programmers, and the
beginners might only use emacs or vi to write their code. However,
since there are such great tools out there to help the programmer, I
am wondering which tools are considered to be the best and most
effective?

In other words, what kind of tools are the "elite" programmers using?
I am sure they are not just using a simple editor..

I'm not sure that it's an *exclusive* thing. I use cscope, tags, etc...
IN CONJUNCTION WITH vi. I suspect most "elite" (as you call them)
programmers don't see it as an either-or thing as well, but rather, "use
the right toolset for the job".

I've been writing C for over 20 years (Holy shit, it really has been
that long), and I prefer vi/makefiles/cc to any IDE, becuase I *KNOW*
what's going on. I use Visual Studio in my current job (not my choice),
and I can't stand it, partly because I'm not sure what's going on under
the hood....

Of course, I might just be a control freak.
 
D

Default User

CBFalconer said:
On the contrary, that is just what they are using.


All of my career has been spent either using Integrated Developement
Evironment tools or standalone editor, compiler and debugger sets.
Sometimes (like my current setup at home) I don't even bother with a
debugger.



Brian Rodenborn
 
K

Kenny McCormack

On the contrary, that is just what they are using.

Yes. More often than not, those tools (IDE, etc) are created for, and used
by, the less capable. Not that there is anything wrong with being less
capable.
 
M

Michael Mair

Hi markus,

There are ofcourse many different levels of programmers, and the
beginners might only use emacs or vi to write their code. However,
since there are such great tools out there to help the programmer, I
am wondering which tools are considered to be the best and most
effective?

In other words, what kind of tools are the "elite" programmers using?
I am sure they are not just using a simple editor..

Brain, editor, compiler. In that order.
Apart from that: Debugger, manfiles or other library documentation.
Everything else depends.

If the code you want to produce or work at is huge:
- make
- tags
- some documentation generator
- cvs, diff, patch

If it is s.th. new to you, typically huge, largely undocumented, go
at it with
- tags
- some documentation generator

If the modules are comparatively small, not all by you and probably
bugridden
- compiler warnings
- splint (-weak|-normal)
- some documentation generator

If you are going to work with it every day for a long time:
- get to know the environment and tailor your own tools


It is nice to have the perfect environment for your work. In my
experience, "perfect" depends on the task at hand. A certain IDE
might be exactly the right thing for providing short event-handling
routines, but too opaque for doing something else.
Apart from that: If you are not very sure that it will be only for
a short time, then get the standard tools working you think necessary.

Having a good coding style is more important. Good meaning: producing
easy-to-maintain, safe etc code in an efficient manner. But even these
things depend on whether you are working alone, in a team with
colleagues or in an open source project with everyone and no one.


Cheers,
Michael
 
J

Jack Klein

Hi,

As I been programming in C I have discovered more and more tools that
really helps to speed up the development process when writing
programs. Examples of such tools are cscope, cbrowser, tags, etc.

There are ofcourse many different levels of programmers, and the
beginners might only use emacs or vi to write their code. However,
since there are such great tools out there to help the programmer, I
am wondering which tools are considered to be the best and most
effective?

In other words, what kind of tools are the "elite" programmers using?
I am sure they are not just using a simple editor..

It would be really interesting to get some opinions on which tools
speed up the development process the most. I would say that cscope
with cbrowser is the most effective tool to help the development
process, especially if there is a lot of new code to get into.

Best regards

Others have written some good answers, but I am rather surprised that
no one has mentioned lint. There is a commercial implementation for
Windows from http://www.gimpel.com and an open source version
available at http://www.splint.org.

I have never used splint, but Gimpel's PC Lint is worth its weight in
gold. It takes some effort to customize it to your style and the type
of programming that you do, but it can repay that initial time dozens
of times over.
 
G

G. S. Hayes

Hi,

Examples of such tools are cscope, cbrowser, tags, etc.

There are ofcourse many different levels of programmers, and the
beginners might only use emacs or vi to write their code. However,
since there are such great tools out there to help the programmer



I find ctags more useful than cscope in general. In particular I use
the ctags formerly bundled with Vim (exuberant ctags) (off-topic:
works well with other languages too, as diverse as ASP, Python, Java,
Scheme, and Fortran to name a few). And of course find and grep are
incredibly useful on large source trees.



make integration with the editor (as vim and emacs do naturally) is
nice.



Anyway, I find that 98% or more of development is done with a simple
editor and compiler. Other useful tools:



gdb (or whatever your debugger of choice is). You can pretty easily
wire it up so that a segfault (SIGSEGV) fires up a debugger, attaches
to the current process, and gives a stack trace. Can be somewhat
handy.

strace (or truss) to trace system calls

ltrace to trace library calls

For some applications, lsof and netstat (to list open files and
network sockets)

ElectricFence, a memory debugger. Very handy if you've got memory
problems (those mysterious segfaults usually get moved up to where
invalid memory access first happened)

The Boehm-weiser garbage-collecting malloc implementation can be
compiled in a memory leak detection mode that I've found helpful a
couple of times (especially if you're debugging a big third-party app
with memory leaks)

CVS or Subversion (or equivalent); I find it useful to version my
files even when I'm working alone, so I can more freely try out
different approaches.



I still find myself doing printf debugging most of the time (to the
point that I get familiar with http -X for large web applications or
equivalent ways of making sure I can run synchronously and on
console).



And of course, getting a second pair of eyeballs to look at things is
handy.



Failing that, it's useful to pretend you're writing to a newsgroup for
advice and go through all the steps they would ask you for ("They're
going to want a minimal test case. Okay, I'll write one. They're
going to ask if I've tried this edge case. Okay, done. They're going
to ask if I've tried this edge case. Okay, done."). It's amazing how
often I can find a bug that I've spent a half hour or more chasing if
I just sit down and approach it from that perspective ("They're going
to ask if I've tried passing zero to that function--oh, wait, that's
not right. Duh, what a stupid bug.").



Worst case you can post a message that has the minimal test case and a
list of all the things you've tried.
 
B

boa

markus said:
Hi,

As I been programming in C I have discovered more and more tools that
really helps to speed up the development process when writing
programs. Examples of such tools are cscope, cbrowser, tags, etc.

There are ofcourse many different levels of programmers, and the
beginners might only use emacs or vi to write their code. However,
since there are such great tools out there to help the programmer, I
am wondering which tools are considered to be the best and most
effective?

In other words, what kind of tools are the "elite" programmers using?
I am sure they are not just using a simple editor..

It would be really interesting to get some opinions on which tools
speed up the development process the most. I would say that cscope
with cbrowser is the most effective tool to help the development
process, especially if there is a lot of new code to get into.

Best regards


- The assert() macro is quite useful, both for asserting that function
parameters are correct and for asserting that my own code is correct.

- Module test programs are always good. Takes some time to write, but is
nice to have when that hard to find bug comes along. gcov or similar
programs can help you check that the test programs test all the code.

- valgrind, http://valgrind.kde.org, is a *very* useful tool on Linux
platforms. If you're on Linux, do yourself a favor and try valgrind.

- A profiler, e.g. gprof, is also a good idea to use to find performance
bottlenecks. Use a profiler to find the bottlenecks instead of wasting
hours/days optimizing non-critical code.

- Keeping it simple is always a good idea. As K&P said, IIRC, debugging
is twice as hard as writing code, so if you write the most complicated
code you can, you won't be able to debug it..

- A good tool is your brain. Don't be sloppy, but write code the way you
*know* it is supposed to be written even if it taks a little bit longer.


HTH
boa@home
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top