combining workspaces

H

hurry

I have two different set of codes (say A and B workspaces) I want to
call the entire B as a function inside A.I want a solution to do this.

To my knowledge, one soltn. would b to add all files of B in A's
workspace and compile like any other fnuction but, the pblm here is
both B and A are huge piles of codes and at many places happen have
same variables ( in their declaration in header). so, for this soltn.
to work, I`ll have to change all the variables in their headers and in
..C in B's workspace ( which is a HERCULIAN task, considering the
voluminosity of the codes).

Points here to be noted abt the program are:
1) A calls B in a loop and gives an input and needs an output.
2) B does not need to hold any variable betwn its entry (in other
words) shortly/vaguely, B does not need to have any static variables.

Is there a way like, when I call B the entire A's workspace goes behind
the screen and does not have any clashes betwn same variables decalred
in headers of A and B.

I have no idea of C++ and would like to know if there is a solution to
this either in C/C++ compiler ( thou a soltn. in C wud save my time).

bye,
hurry.
 
A

Alf P. Steinbach

* hurry:
I have no idea of C++ and would like to know if there is a solution to
this either in C/C++ compiler ( thou a soltn. in C wud save my time).

That means you're off topic clc++ (this group). Try clc.
 
H

hurry

c if u can hlp me now.

I have two different set of codes (say A and B workspaces) I want to
call the entire B as a function inside A.I want a solution to do this.

To my knowledge, one soltn. would b to add all files of B in A's
workspace and compile like any other fnuction but, the pblm here is
both B and A are huge piles of codes and at many places happen have
same variables ( in their declaration in header). so, for this soltn.
to work, I`ll have to change all the variables in their headers and in
..C in B's workspace ( which is a HERCULIAN task, considering the
voluminosity of the codes).

Points here to be noted abt the program are:
1) A calls B in a loop and gives an input and needs an output.
2) B does not need to hold any variable betwn its entry (in other
words) shortly/vaguely, B does not need to have any static variables.

Is there a way like, when I call B the entire A's workspace goes behind
the screen and does not have any clashes betwn same variables decalred
in headers of A and B.

bye,
hurry.
 
C

Christian Gollwitzer

hurry said:
c if u can hlp me now.

I have two different set of codes (say A and B workspaces) I want to
call the entire B as a function inside A.I want a solution to do this.

C++ doesn't know about "workspaces". Maybe namespaces can solve your
problem? Works like this:

namspace A {
int somevar;
}

namespace B {
int somevar;
}

now you have different A::somevar and B::somevar. YOu could e.g. (with
care) do:

namespace A {
#include <aheader1.hpp>
#include <aheader2.hpp>
}

etc.
Christian
 
R

Rolf Magnus

hurry said:
c if u can hlp me now.

i cnt hlp u.
And repeating the question won't change the fact that it's off-topic. C++
doesn't define such a thing as a "workspace", and neither does C. My guess
is you're talking about some kind of programming tool, which is off-topic
here. Try finding a newsgroup about programming for your
compiler/toolchain/system/...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top