• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 261
  • Last Modified:

Tool to port / convert SAS C to ANSI C???

Does anyone have a tool that converts old-style C Code to ANSI C for use with the GCC compiler?  If no tool or conversion script exists, is it feasible to create one?  I'm looking for the types of issues (syntax, obsolete header files, data types, etc) that I need to be aware of to port a HUGE amount of code over to work with a new system that uses ANSI C and compile successfully.  Thanks in advance!!!
0
wmv678
Asked:
wmv678
1 Solution
 
wmv678Author Commented:
Also, I believe the current "old-style" C code is SAS/C.
0
 
AxterCommented:
Hi wmv678,
> >converts old-style C Code to ANSI C

The old-style C should still work with GCC compiler.

David Maisonave :-)
Cheers!
0
 
grg99Commented:
gcc can accept old-style C.  But a lot of old-style C may have been crafted to work with a particular compiler and it's quirks and features.

A lot of things can break-- things like the size of ints, the size of pointers,  near and far memory models, direct int 21h or BIOS calls, structure sizes and padding..   You basically have to go over the code and see if it still compiles, links, and runs.  In typical old code you'll find some glitch every 20 to 30 lines.


 
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
wmv678Author Commented:
There are certainly a lot of quirks.  The orginal code is the Mainframe Version of SAS/c (MVS?), and the goal is to move it to a new Linux platform running the G++ compiler.  Sorry for stating GCC earlier, but G++ should handle anything GCC can handle anyway, right?  I'm looking for more specific examples if changes that need to be made to the code to get it to run correctly, so that we can develop a set of rules to follow as we port over the code.  I understand that the "rules" won't capture every little quirk and situation, but it should be a start, or even better, the basis for a script that does a first pass over all the code, because we have over a million lines.

For example, current compile issues:

Mainframe uses (| |)     ...    needs to be [ ]

int f(x)               needs to be            int f(char * x)  
  char * x
0
 
AxterCommented:
>>G++ should handle anything GCC can handle anyway, right?

Just make sure you don't change the name of the file extension.
Dont' change file name from foo.c to foo.cpp

If you keep the file name to a C file extension, the above Old-Style C should compile.
0
 
jmcgOwnerCommented:
wmv678  -

This old question needs to be finalized — accept an answer, split points, or get a refund.  For information on your options, please see

http://www.experts-exchange.com/help.jsp#hs5

Once more than 21 days have passed with no new responses posted, a question is considered abandoned.  If you do nothing, I will make a recommendation to the moderators on its resolution in approximately 4 to 14 days.

EXPERTS -  I would appreciate any comments that would help me in making a recommendation.

At this point, I'm concerned that the reassurances the gcc will handle the code are too optimistic. It is not clear that the experts who have responded have dealt with this particular variant of C, so they have given general, rather than specific, advice. It's not bad advice, it just doesn't help very much. The decision is up to wmv678, but I'll likely recommend, if he or she does nothing, for PAQ/Refund.

jmcg
EE Cleanup Volunteer
0
 
wmv678Author Commented:
jmcg-

I agree with your last statement.  If anything, I would award grg99 partial points.  However, the other comments were inaccurate and not useful.

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now