Solved

C souce code converter

Posted on 2000-02-22
10
207 Views
Last Modified: 2010-04-15
Hi all,

could anybody tell me a tool/software by which i can  do the following.

in any .c file
it should change
int f(param1,param2,...)
type1 param1;
type2 param2;

style definition to

int f(type1 param1 ,type2 param2);

Actually I am trying to compile some code using this old style function definition in aCC compiler on HP-UX 10.2
which as a C++ compiler does not allow this and i have to use this compiler only.

Please reply ASAP.

0
Comment
Question by:bhel
10 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 2546115
Did you check the HPUX compiler docs?

I haven't used it in a while but there is a command line switch to permit the old-style non-ANSI C.
0
 
LVL 3

Expert Comment

by:ufolk123
ID: 2546188
Hi jhance

i think you might be talking about cc or CC compiler that comes with HP-UX 10.2.But there latest compiler aCC do not have this option.On this compiler the same options has been used to enable some ANSI C++ features.
Please give me some idea about how to go about it some other way ( code change to new style will cost me very high).
0
 
LVL 2

Expert Comment

by:AndrewRodionov
ID: 2546575
What kind of "disallowing" did you meet? What kind of errors? Warnings?
And what flags do you use?..

Andrew Rodionov
0
 
LVL 3

Expert Comment

by:ufolk123
ID: 2548799
Hi AndrewRodionov ,

It gives this problem

Error 43: "mxx_nodeadd.c", line 98 # C++ does not allow Old-style
    (non-prototype) function definitions.
    static int fn_mkdata(s_node,p_cursol,p_addr)


where line 98 in code is


static int fn_mkdata(s_node,p_cursol,p_addr)
char                   s_node[];
struct _st_cursol_t   *p_cursol;
struct nodeadd_t      *p_addr;
{


Regards,
bhel

0
 
LVL 2

Expert Comment

by:AndrewRodionov
ID: 2549057
Hi!

I'm using cc and gcc compilers on Compaq Tru64 UNIX (formerly Digital UNIX) sometimes and not familiar with HP-UX but both compilers has the flags to compile old-style programs. For example, cc understands -std0 (and -common or -traditional) and gcc understands -fno-strict-prototype and -traditional.

And why your C-code (file mxx_nodeadd.c) has compiled as C++-code? What compiler do you use? Is it aCC (that I don't know)? Or it's just a slip of pen and you mean cc?..

Andrew Rodionov
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

Author Comment

by:bhel
ID: 2549935
Hi Andrew,
This is not a typo.I am using aCC compiler which is a new C++ compiler and  ihave no other option but to use this compiler only  for compilation.Changing code to new style is highly time consuming task so please suggest something.
0
 
LVL 2

Expert Comment

by:AndrewRodionov
ID: 2550301
I'm sorry but I don't know aCC compiler.

If you can't use cc or gcc/g++ compilers you should change the source code probably...

Andrew Rodionov
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 2552710
aCC is the command for running the aC++ HP compiler.

Use cc to run the ANSI-C compiler.

0
 
LVL 3

Expert Comment

by:LucHoltkamp
ID: 2554063
Write a simple filter that reformats your code...
Luc
0
 
LVL 3

Accepted Solution

by:
Iexpert earned 50 total points
ID: 2555107
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now