From: suresh <su...@em...> - 2002-11-27 23:37:07
|
Hi, I want to change the function return type from double to string. Can anybody tell me how to accomplish it? //sample code Class A { Public: A(){} ~A(){} double func(); }; double A::func() { double d; cout<<"func is called"<<endl; return d; } In this code, I want to change the function return type to char in all the places i.e. in function declaration and definition. Inside the function definition, I am able to change it but not the return type. Any help is welcome. - Thanx SureshLalwani. -----Original Message----- From: own...@cs... [mailto:own...@cs...] On Behalf Of Grzegorz Jakacki Sent: Tuesday, November 26, 2002 2:10 AM To: OpenC++ Subject: RE: [opencxx] Looking for help On Mon, 25 Nov 2002, suresh wrote: > Hi, > I have solved the first and third problem mentioned in my previous > email. Thanx for you guys help. For the second problem, which is finding > the instantiation of all the objects of a class (classA), I just need to > know the instantiation statements. I don't want any runtime information. > Based on the objects (object names), I have to add MACROs in the header > file of ClassA. The macro will take object name as an argument. > > Explaination: > > /* classA in file classA.h and classA.cpp */ > Class classA { > ..... > ..... > ...... > } > > /* classB in file classB.h and classB.cpp */ > class classB { > ..... > classA objA1; > classA objA2 = new classA; ^^^^^^^^^^^^ classA* objA2 ? > ..... > } > > Now I need to add MACRONAME(objA1) and MACRONAME(objA2) in the header > file of classA. Do you want to translate individual header files? It is going to be difficult, since OpenC++ sits behind preprocessor, so it does not really see separate header files. If it is enough to just add the macros in *translation unit*, that should be easy (see AppendAfterTopLevel()). Remember to instruct OpenC++ to perform second preprocessor pass. If this advice is not what you are looking for then I am afraid you have to shed some more light on why do you need those macros. > Any help is welcome. I am facing one more problem, I > tried translateNew But translateNew's arguments don't have the object > name. Because object created with "new" does not have a name. What do you mean by "object name" in: some_function(2, new classA); ? Do you really want to find all instantiations or just instantiations of some specific form (e.g. "classA* ID = new classA") and nothing else? Best regards Grzegorz ################################################################## # Grzegorz Jakacki Huada Electronic Design # # Senior Engineer, CAD Dept. 1 Gaojiayuan, Chaoyang # # tel. +86-10-64365577 x2074 Beijing 100015, China # # Copyright (C) 2002 Grzegorz Jakacki, HED. All Rights Reserved. # ################################################################## |