473,466 Members | 1,412 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

recompiling..

I have some qustions about recompiling in c++..

Let me show you my example..
I've got a class which has private member..

class A{
private:
void somefunc();
};

and client using it.. in different file

int main(){
A a;
// use A in whatever ways we want :)
// but except using private function
// Actually that's not legal
}

My question is if I chang the declaration of class A, for example changing
the private function name 'somefunc' to 'anyfunc', will the client code be
recompiled?
Jul 22 '05 #1
3 1197
BekTek wrote:
I have some qustions about recompiling in c++..

Let me show you my example..
I've got a class which has private member..

class A{
private:
void somefunc();
};

and client using it.. in different file

int main(){
A a;
// use A in whatever ways we want :)
// but except using private function
// Actually that's not legal
}

My question is if I chang the declaration of class A, for example changing
the private function name 'somefunc' to 'anyfunc', will the client code be
recompiled?


What gets recompiled in which situation is not defined in standard C++. It
depends on the toolchain you are using. Usually, some make tool is used. It
has a Makefile, from which it gets dependancy information and rules how to
build what from what. And if some file 'a' depends on a file 'b', and you
change b, a will be recompiled. So in your case, if your class definition
of class A is in a file called a.h and your main() function is in main.cpp,
then main.cpp would be recompiled if a.h was changed, and make doesn't
really care what the change was, just _that_ it changed. But as I said,
this is not a matter of the C++ language, but rather of the toolchain you
use for building your program from the sources.
Jul 22 '05 #2
Alrighty, thanks..
That's why pimpl comes, right?

"Rolf Magnus" <ra******@t-online.de> wrote in message
news:co*************@news.t-online.com...
BekTek wrote:
I have some qustions about recompiling in c++..

Let me show you my example..
I've got a class which has private member..

class A{
private:
void somefunc();
};

and client using it.. in different file

int main(){
A a;
// use A in whatever ways we want :)
// but except using private function
// Actually that's not legal
}

My question is if I chang the declaration of class A, for example changing the private function name 'somefunc' to 'anyfunc', will the client code be recompiled?
What gets recompiled in which situation is not defined in standard C++. It
depends on the toolchain you are using. Usually, some make tool is used.

It has a Makefile, from which it gets dependancy information and rules how to
build what from what. And if some file 'a' depends on a file 'b', and you
change b, a will be recompiled. So in your case, if your class definition
of class A is in a file called a.h and your main() function is in main.cpp, then main.cpp would be recompiled if a.h was changed, and make doesn't
really care what the change was, just _that_ it changed. But as I said,
this is not a matter of the C++ language, but rather of the toolchain you
use for building your program from the sources.

Jul 22 '05 #3
The pimpl idiom is used for information hiding in the first place. But it
also assures that the client doesn't need to recompile his code unless
there are changes made to the interface, that's correct.

BekTek wrote:
Alrighty, thanks..
That's why pimpl comes, right?


Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ryan Liu | last post by:
All, Now I have meet a strange problems. When all the files have been compiled and when linking, make always recompiles some files. I don't know why. Would you mind giving some suggestion? The...
10
by: BBFrost | last post by:
We just recently moved one of our major c# apps from VS Net 2002 to VS Net 2003. At first things were looking ok, now problems are starting to appear. So far ... (1) ...
3
by: Lucas Tam | last post by:
Does recompiling cause session objects to disappear? -- Lucas Tam (REMOVEnntp@rogers.com) Please delete "REMOVE" from the e-mail address when replying....
4
by: Christopher Ireland | last post by:
Hi all, I've got an app written under the v1.1 of the .Net framework and I'm now considering recompiling it under v2.0. Can I expect my app to run any faster? Are there any advantages to...
9
by: friendhouston | last post by:
Hi, Have a requirement where new items may be added later to an existing list of items. These new items may have new features but will need to contain minimum basic features like description and...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.