Automatic translation of source C to C89 or C90

So, I am working on this C / C ++ library and I am using the GNU compiler which supports the latest C and C ++ standard.

I want my library to be compatible with the VC ++ compiler, which only supports C89 / C90 and not the new C standards that allow variable declarations after other statements inside the function body.

Is there a tool I can use that will make all my variable declarations at the beginning of function bodies?

My library is quite large and a tool for doing this will make the process easier.

+3


source to share


1 answer


Sorry for the anti-answer, but Visual C ++ is not a C compiler. It might be a compiler for an old, obsolete (22 years old, to be exact) language that is not C. Your best bet should be to advise people asking you about such support, and ask them to switch the compiler and not use the broken one.

If this solution is really outside the scope of your choice (it is not), then there are similar topics you might find: How to compile a c99-to-c89 converter with clang? https://github.com/libav/c99-to-c89/

If you think what I said, there is no point in thinking again: this is a 22 year old obsolete C compiler. Think of the effort and money that people all over the world have spent supporting it.



Edit: btw that C: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf

http://www.open-std.org/jtc1/sc22/wg14/www/standards

+3


source







All Articles