|
I have created an SDI app with view/document architecture. Reviewing many books on this concept, I understanding there is linkage with pointers between the following:
1) Application Object to Document Template
2) Document Template to Document Object
3) Document Template to FrameWindow
4) Document Object to View Object
5) View Object to Document Object
5) Frame Window to View Object
Yes, nice concepts but how do I use these pointer, no good "real examples".
4 books later and I am still ripping my hair out. Can someone show some code snippets on how I would initialize the pointers and use these pointers.
For example in my app I have some data coming from a comm port, using a 3rd party C++ lib, a function is called when a new comm msg arrived. I would like to store this data in the Document object which would then call a Document Object method that would execute CDocument::UpdateAllViews to notify the View to get the new data from the CDocument object and update the displayed screen. How can I directly call a CDocument method that I add to my project, i.e from the function that is called with the new comm msg arrives ? My other thought is to post a message to the CDocument object which would trigger the view updating. I understand the concept of this view/document architecture just need some help in "real code" snippets. If I could just get past this concept.
|
|
|
|
|
Hi,
I'm using Embedded Visual C++ 4.0 for this project so it's a little different than the recent versions of VC++ but by and large it's the same interface, albeit more similar to the older Visual Studio 6.0 from years past.
So the problem is this:
I have a large project that consists of several smaller projects. One of these smaller projects, a lib project, keeps fully recompiling every darned time I compile the project, even though no changes have been made to it. The other lib files are fine, they don't recompile unless I change one of their cpp/h files. I'm sure it's just some silly setting on this lib project but for the life of me I can't find it. Does anyone know what I can do to stop it from recompiling every time?
Thanks!
KR
|
|
|
|
|
Is there some way of showing a verbose listing of what the build system's doing? It might tell you what file(s) it's looking for that's causing the rebuild?
Alternatively (and this is something I've done with VS2003/8), you could use SysInternals ProcMon to see what files the build system (msdev for eVC++4?) is accessing - you may well see it looking for files that a) don't exist, and b) aren't built by the build command for some reason.
HTH!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Oops, sorry I forgot to respond to this but I did actually fix it, the project that kept recompiling was looking for files from a project that weren't added into my parent project. I guess somehow since the one sub-project wasn't added into the parent, the files weren't registering as having been compiled "under the project" or something. When I added in the dependant project, everything was fixed.
KR
|
|
|
|
|
Check the dates on the lib-project source files. If (for some reason) they're in the future, the compiler will think the object and lib files are always out of date.
I've seen a similar problem when the computer's system date is in the past. The new object and lib files get this old date, so always appear out of date.
If the lib project uses a DLL with a future date, this can give the same symptoms.
Another guess: The dependencies may not be set up correctly for this lib project.
|
|
|
|
|
|
Good luck (with your homework).
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Probably your teacher could...but he's asking you to provide them to him!!!!
Do your own homework, sunshine! You have so many resources (Google, CP, the web!) that make it easier.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
vidya556 wrote: could anyone please provide me the correct answers?
I don't see any questions.
|
|
|
|
|
|
vidya556 wrote: i had attended an interview so i was asked this but i couldn't understand
Really? You've applied for a job as a C++ programmer (presumably) and you don't know about memory management?
All of those questions are pretty basic, and even if you didn't go into a lot of detail, you should have been able to show a basic understanding of the subject.
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
I am from a mechanical background and fresher so had told him whtever i had know abt the new and delte but he was not satisfied wid the answer.
So is the reason i am asking u guys wid lot of experience to give me the perfect answer for all the above question.
If u find it pretty simple y don't u share the knowledge.
|
|
|
|
|
If you're a fresher, then I'd guess he wanted to judge your level of knowledge for what he'll be teaching you in class. I wouldn't expect someone starting out in progrmming to know much about memory managers, or anything else really.
Anyway, the subject s quite complex, and would take several pages to explain all the details, particularly to the level asked for in your original post. There's really no way anyone can give you the information you need in a single short answer on this board. Your best approach, if you really want to learn this stuff, is to use Google, and read books on the subject.
Alternatively you could ask your tutor / lecturer if he expects you to know this, or if it's part of what he'll be teaching.
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
There are rules[^] to post a query on this forum. Your query does not comply with those, so don't be surprised if you are not being helped.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
|
i am planning to write a function with less than 20 lines
so i ma doubted whether to use inline or macro?
which is better?
|
|
|
|
|
How would declaring a function inline decrease the number of lines of code?
Out of curiosity, what's a "Be programmer"?
|
|
|
|
|
He progressed from "A programmer"?
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
And soon he will only "see programmer"
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Michael Schubert wrote: Out of curiosity, what's a "Be programmer"?
Whether to be or not to be, that's his question.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
DavidCrow wrote: Michael Schubert wrote:
Out of curiosity, what's a "Be programmer"?
Whether to be or not to be, that's his question.
ToBe OR NOT ToBe == -1
Sorry, couldn't resist....
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Be programmer wrote: inline or macro
There are very, very, very, very few reasons to ever consider using a macro rather than an inline function. In fact, your question is a subset of the second item in Scott Meyer's Effective C++ (one of the C++ textbooks you really want to read):
Item 2: Prefer consts, enums, and inlines to #defines
The reasons?
- Macros live outside the type system
- Macros pollute all namespaces
- There can be unexpected outcomes from macros. Consider the following macro function and it's use:
#define CALL_WITH_MAX(a, b) f((a) > (b) ? (a) : (b))
CALL_WITH_MAX(++a, b);
CALL_WITH_MAX(++a, b+10);
Can you predict that reliably? Nope, thought not.
So, to paraphrase...just don't ever use a macro instead of an inline function.
Don't try to micro-optimise before you know what the slow things are...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
In addition to what Stuart said, an inline function probably won't actually "inline" in the compiler if it's 20 lines long. If it's only a few lines, then it might. And I wouldn't really consider 20 lines to be that "small." Generally you only want to inline 1-liners or maybe a few more lines than that, but the compiler will ultimately decide what it lets you inline even if you specifically set the function to be an "inline" function.
KR
|
|
|
|
|
Regardless of the usefulness, you can force most compilers to inline (__forceinline) , no matter how much code is involved.
|
|
|
|
|
Hi Mike,
I always thought even with the __forceinline keyword, the compiler had an option to ignore it and not inline the function (if it feels so). So, is that wrong and the keyword causes the compiler to forcefully make the function inline?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|