473,704 Members | 2,651 Online
Bytes | Software Development & Data Engineering Community
+ 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 1204
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
1294
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 following is the recompiling error? *************************************************** collect: recompiling Time-data.cpp
10
2409
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) ComboBox.SelectedValue = db_value; If the db_value was not included in the ComboBox value list the ComboBox.SelectedIndex used to return -1, Now the very same code is
3
1184
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. http://members.ebay.com/aboutme/coolspot18/
4
1303
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 recompiling my v1.1 app under v2.0? Many thanks for any comments.
9
1790
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 price. These items should be added to the existing code without the code being needed to be recompiled or making minimum changes to the existing code i.e. it should be OCP compliant. Not sure how to go about this . The only things which come to...
0
8767
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8687
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9135
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9026
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7891
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5931
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4439
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4701
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3135
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 we have to send another system

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.