Is there some tool that can automatically convert the following c style code
A *a = b;
to
A *a = (A*)b;
Thanks,
James
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming this is to eliminate compiler errors, I would probably write one myself. Run the compiler on the source, and redirect error messages to a file. Filter out the errors where it complains about the type. For example, in gcc, they will look like this:
This gives you all you need: file and line number, as well as the type you need to cast to (i.e.
int*). Find a likely place in the line to insert the cast (i.e. after the = character, or after the return statement), and try again. Keep track of the lines that you already edited, and skip them for human intervention.