9

I remember from some time ago reading about a commandline tool that explains C code, does anyone know what it might be named?

Karolis
  • 879
  • 1
  • 9
  • 20
  • What kind of explanation are you talking about? A little more specifics, please :) – Kyle Walsh Mar 20 '09 at 18:25
  • More on-topic question: https://stackoverflow.com/questions/1448849/how-do-i-understand-complicated-function-declarations – o11c May 13 '16 at 18:54

3 Answers3

23

Perhaps you mean cdecl, a program that can translate complicated declarations to English and back?

e.g.

cdecl> explain int (*(*foo)(int ))(float )
declare foo as pointer to function (int) returning pointer to function (float) returning int
sigjuice
  • 28,661
  • 12
  • 68
  • 93
  • That's a very nice program by the sound of it. Does it have a home page somewhere? – Michael Myers Mar 20 '09 at 18:29
  • It is a small program and you will find several versions of the source floating around. Most Linux systems that I have encountered seem to have it installed. I believe K&R is the original source. The book uses the program as tool to explain complicated declarations. – sigjuice Mar 20 '09 at 18:51
  • Is there a similar program for parsing complex / obfuscated expressions per chance? (with operator precedence & stuff) – SasQ Apr 30 '19 at 18:02
0

If you mean explaining then I think the answers already been given. If you mean looking for potential problems then there's lint and its variants, first stop in any code review.

Ghoti
  • 2,388
  • 1
  • 18
  • 22
0

http://en.wikipedia.org/wiki/Lint_programming_tool

Edit: C/C++ Free alternative to Lint?

HTH

Community
  • 1
  • 1
plan9assembler
  • 2,862
  • 1
  • 24
  • 13