Hello,
I have inherited a large piece of C code which was written in a non ansi compliant compiler. This compiler allowed variable declaration anywhere within a function body, whereas the Microsoft visual studio version 6 C compiler insists that all variables must be declared at the beginning of a function body. I dont have knowledge or access to the old compiler, so I am trying to get the code compiling in Visual studio C/C++ ver 6. It is a big job to go through the code and move all variables to the beginning of the function they are declared in so I have been trying to see if it is possible to switch off in Visual studio the rule that all variables must be declared at the beginning of a function body.
So far I have tried renaming my files from .C to .CPP and also I tried changing my C/C++ compiler settings switch from /Tc to /TP. This enabled me to compile the code with variables declared anywhere in a function however I now find parts of the code which uses the keywords "enum" and "typedef struct" no longer compiles.
Any suggestions would be greatly appreciated.
Thanks in advance
I have inherited a large piece of C code which was written in a non ansi compliant compiler. This compiler allowed variable declaration anywhere within a function body, whereas the Microsoft visual studio version 6 C compiler insists that all variables must be declared at the beginning of a function body. I dont have knowledge or access to the old compiler, so I am trying to get the code compiling in Visual studio C/C++ ver 6. It is a big job to go through the code and move all variables to the beginning of the function they are declared in so I have been trying to see if it is possible to switch off in Visual studio the rule that all variables must be declared at the beginning of a function body.
So far I have tried renaming my files from .C to .CPP and also I tried changing my C/C++ compiler settings switch from /Tc to /TP. This enabled me to compile the code with variables declared anywhere in a function however I now find parts of the code which uses the keywords "enum" and "typedef struct" no longer compiles.
Any suggestions would be greatly appreciated.
Thanks in advance