0

I've just inherited some C code, which is quite new, paradoxically, but have the old function syntax. As you know it looks like this:

void old_style( c , a )
    char c; 
    int a; 
{}

What I want to do is to parse the whole code and converse the old syntax to new one. But before I start, I wanted to know if by chance I won't reinvent the wheel. So, do you know some existing solution to this?

Joe DF
  • 5,438
  • 6
  • 41
  • 63
  • I saw some nice transformations done with clang, look around, perhaps they have something for this. – Karoly Horvath Nov 09 '13 at 19:51
  • Just respect the good old wo/man writing the code and keep it. –  Nov 09 '13 at 19:54
  • @KarolyHorvath: given that clang targets parsing standard C and C++ I'd doubt that clang supports reading K&R syntax. However, gcc used to contain `protoize` to do the conversions. I don't know if contemporary versions still include this program, though. – Dietmar Kühl Nov 09 '13 at 19:55
  • @DietmarKühl: Isn't K&R syntax part of the standard?? – Karoly Horvath Nov 09 '13 at 20:16
  • @KarolyHorvath: It is certainly not part of the C++ standard and, as far as I know, it is also not part of the C standard. I'm not enough of a C expert to make an authorative statement on whether K&R declarations are supported. Actually, [this answer](http://stackoverflow.com/a/18422382/1120273) seems to imply that K&R syntax is part of the C standard! Something new to learn every day...! – Dietmar Kühl Nov 09 '13 at 20:22

0 Answers0