|
Hi,
After having WaitForSingleObject() function next to WaitCommEvent() function, the CPU rate become less.
With Thanks & Regards,
Suman
|
|
|
|
|
Hello everyone,
Could anyone show me the usage of pointer_default please (sample of when we need to use ref, unique and ptr)? After some search, I found too little materials on this topic.
thanks in advance,
George
|
|
|
|
|
George_George wrote: Could anyone show me the usage of pointer_default please (sample of when we need to use ref, unique and ptr)?
The ref attribute identifies a reference pointer. It is used simply to represent a level of indirection. Can not be NULL .
The unique attribute specifies a unique pointer. Can be NULL .
The ptr attribute designates a pointer as a full pointer. Can be NULL .
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi DavidCrow,
I also got the similar one-setence description from other books, but no detailed description. Especially for ref and unique, what are the restrictions (exception nullable) compared with normal pointer ptr? Any ideas?
regards,
George
|
|
|
|
|
George_George wrote: Especially for ref and unique, what are the restrictions (exception nullable) compared with normal pointer ptr? Any ideas?
Here are whole pages on ref and unique. As an added bonus, there are even code samples.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Read the Remarks section of this to understand aliasing.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks DavidCrow,
I have some further issue for unique attribute after some study for the link you recommended.
http://msdn2.microsoft.com/en-us/library/aa367294(VS.85).aspx[^]
(Especially confused about "before the call")
--------------------
Can use existing memory on the client without allocating new memory. When a unique pointer changes during a call from one non-NULL value to another, the pointer is assumed to point to a data object of the same type. Data returned from the server is written into existing storage specified by the value of the unique pointer before the call.
--------------------
I do not know why "Data returned from the server is written into existing storage specified by the value of the unique pointer before the call", especially "the value of the unique pointer before the call".
Suppose the following scenario,
1. client pass point ptr1 to server and ptr2 originally pointed to memory buffer1;
2. server change ptr1 to pointed to memory buffer2, which is different from buffer1;
3. server writes data through pointer ptr1, it should be written to buffer2.
So, it should be,
Data returned from the server is written into existing storage specified by the "lastest" value of the unique pointer, which is memory buffer 2.
Other than,
Data returned from the server is written into existing storage specified by the value of the unique pointer "before" the call, which is memory buffer 1.
Any comments?
regards,
George
|
|
|
|
|
Hello everyone,
The situation when we need to use this class is, we want to continue to append the content of string (not at one time, but at many times -- appending). Right?
Any other situations which use of this class (compared with other string and stream related class) will give us special benefits?
thanks in advance,
George
|
|
|
|
|
You can also expoit polymorphically the ostrsrteam inheritance from ostream to redirect the output on a string. The following (silly) sample depicts the idea
class HiFolks
{
ostream * _pos;
public:
HiFolks(ostream * pos):_pos(pos){};
void setos(ostream * pos){ _pos = pos;}
void sayHi()
{
(*_pos) << "hi folks" << endl;
}
};
void main()
{
strstream s;
HiFolks hf(&cout);
hf.sayHi();
hf.setos(&s);
hf.sayHi();
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Thanks CPallini,
Cool sample!
Two more comments,
1. You agree with my points in original post?
2. In MSDN, there is no inheritance hierarchy information (at least I can not find from API document for ostrstream, could you find such information from MSDN)? for example ostrstream inherits from ostream.
regards,
George
|
|
|
|
|
George_George wrote: 1. You agree with my points in original post?
Since it is a (output) stream, yes.
George_George wrote: 2. In MSDN, there is no inheritance hierarchy information (at least I can not find from API document for ostrstream, could you find such information from MSDN)? for example ostrstream inherits from ostream.
Yes, here [^] (check out the grey rectangle).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Thanks CPallini,
For the "grey rectangle" you mentioned, do you mean the grey rectangle containing text "class ostrstream : public ostream", we can not click it to expand, and we only know ostrstream directs inherits from ostream. Right?
Sorry I have not made myself understood, is there an electronic form of all the classes hierarchy (GUI) form from MSDN?
regards,
George
|
|
|
|
|
AFAIK there isn't such diagram for STL in MSDN.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Thanks CPallini,
My question is answered. There is a hard copy in Bjarne's book.
regards,
George
|
|
|
|
|
George_George wrote: Any other situations which use of this class (compared with other string and stream related class) will give us special benefits?
This boost library[^] uses stringstream and offers a good way of formating strings.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
|
Sure.
ostringstream is part of the Standard.
If you are interested in some background, there is a chapter in N. Josuttis "The C++ Standard Library"
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Thanks jhwurmbach,
My question is answered.
regards,
George
|
|
|
|
|
Hi Friends,
I am in need to extract the exported
functions of a DLL.
If a DLL name is given,all exported functions in that
DLL must be listed out.
I used Dumpbin and tdump utility tools to do so.
But I need to make this without using any utility tools,
just mere by coding.
Could anyone please help me?
|
|
|
|
|
Can you give more details? Is the DLL loaded into the memory space of the process used to list the exports?
Steve
|
|
|
|
|
The DLL is chosen by the user.
Once it is chosen,the names of the
exported functions in that DLL has to shown.
So it is during runtime the DLL is known, for
which its functions are listed out.
Thanks!
|
|
|
|
|
poda123 wrote: But I need to make this without using any utility tools,
just mere by coding.
Use SymEnumSymbols . It takes a callback function pointer which in turn gets called for every symbol found, as a parameter to the function you get a pointer to a SYMBOL_INFO structure.
Use the Flags member of this struct along with SYMFLAG_EXPORT to find out whether this particular symbol is exported or not.
I am doing the same in my Process viewer article here -> http://www.codeproject.com/KB/cpp/processviewer.aspx[^]
I guess you will have to load the DLL into your process. Not sure!
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Thanks for your reply.
I tried to execute the process viewer,
but could not run due to the error message
"...desktop\procviewer\utils.h(829) : error C2065: 'SLR_NOSEARCH' : undeclared identifier"
Could you please help me out to run your application,where
I can learn more things out there.
Thanks!
|
|
|
|
|
poda123 wrote: Could you please help me out to run your application,where
I can learn more things out there.
Do you have latest platform sdk installed?
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|