|
Hi
I have a CAsyncSocket Class as a member of a CWinThread Class
To start the TCP/IP conversation I do a PostThreadMessage to a Worker UI thread
which has CAsyncSocket as a member and do a CAsyncSocket::connect
However When the FrameWork calls both the CasyncSocket::OnConnect and CAsynScoket::OnSend
I can tell Visual Studio Debugger -> Thread display that the thread id is that of the main thread
I am having problems doing the subsequest CAsyncSocket::Send and am guessing this more than likely the issue
Thanks
|
|
|
|
|
The
CASyncSOcket notifications OnConnect OnSend owned by main thread
|
|
|
|
|
Your question is not clear...
|
|
|
|
|
I contacted Joseph Flounder and He explained That CAsyncSocket notifications
OnSend, OnConnect are intitally received in the context of the main thread
I detach the socket do a PostThreadMessage to the Thread with the CAsynsocket derived
member do a Attach
and from that point on all notification are received in The UI CWinThread
|
|
|
|
|
#include <stdio.h>
int main(void)
{
int x=2;
printf("%d\n%d\n",x++,x++);
}
why the result is 4 4 not 3 4 ?!
|
|
|
|
|
Google for "order of evaluations." It's a much-talked-about subject.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
The order of evaluation of the two post increment operations (x++) is not guaranteed. Using gcc I get 3, 2, using clang I get 2, 3. Both are valid answers, as are would be any combination of 2, 3 and 4. In fact, it would not be a surprise if different levels of optimization produced different results.
I think the only thing that can be guaranteed is that the value of x will be 4 after the call to printf().
|
|
|
|
|
You got this result because the optimizations are on.
The compiler choose an optimization that leads to the final result not considering what the values could be in the same call. This is consistent with C99, C11 and C++11 standards that to privilege the best optimization of code state that the order of evaluation of the parameters of a function is undefined, and compiler dependent (but also situation dependent different conditions of optimization will lead to different results).
If you test your code with different compilers you'll get different results.
Please consider that even with optimizations off the compiler could give 'strange' values.
BTW the more common output you should expect should be '4 3', because the parameters should normally be evaluated from right to left (incrementing 2 to 3 and pushing it on the stack, then incrementing it to 4 and pushing it on the stack).
When optimization are on basically the compiler decides to make a double increment in one time (instead of move back to the same variable for a second increment).
|
|
|
|
|
The code produces undefined behavior - you are modifying an 'lvalue' twice between 'sequence points'.
Undefined behavior means precisely that; the compiler is at liberty to generate code that will format your disk, or even make demons fly out of your nose. Be thankful that all it did was give you an unexpected result.
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.
--Winston Churchill
|
|
|
|
|
Hmm, I never had demons fly out of my nose - I think I need to try harder!
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
One of the regulars on the newsgroup comp.lang.c invented a notional system - the DeathStation 9000. The C compiler for that system would interpret undefined and implementation-defined behavior in the worst possible manner, up to and including creation of nasal demons...
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.
--Winston Churchill
|
|
|
|
|
Well after finishing logical gates and making the Computer.hdl
(Nand2tetris)
We started learning about assembly
this is only the second lesson and we learnt so far a bit about offset lea and signed and unsigned
i need help solving this exercise and on the way the explenation why and how because iv been searching tyhe web for 2 days now and i got no luck so far
; Print '15', using ONLY 'mov' and 'lea'.
; Do NOT use arithmetic instrutions (add, inc, mul, etc.)
PRINTN "Part (C) - should print 15"
mov ax,10
mov bx,4
mov cx, lea [ax + bx+1]
mov ax,cx
call print_num
PRINTN
modified 4-Jun-15 14:07pm.
|
|
|
|
|
a random user wrote:
i need help solving this exercise... Just curious, but isn't that what the instructor (or the TA) is for? Are instructors these days just off limits to questions?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
the instructers are not allowed to help us
|
|
|
|
|
But a bunch of strangers are?
|
|
|
|
|
Who are you calling strange, Richard?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
|
As a rule, we don't help with homework. That said, I'll give you a hint; the solution is related to loading ASCII codes for characters into AX.
|
|
|
|
|
|
How to give administrator rights to my mfc application without manifest file
|
|
|
|
|
You can specify to "run as administrator" in the shortcut that points to the program.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Thanks for your valuable information but i would like to ask admin rights to my application programatically while run by the user.
|
|
|
|
|
You cannot set administration rights within a program, it must be set externally by the manifest, or by the user at startup. There would be no point in having a security framework if it was possible.
|
|
|
|
|
Inorder to prevent the theme from modifying my application i have disabled the manifest file the admin rights is found in the manifest file.what should i do to prevent my application being modified by theme without disabling manifest.Your suggestion would help me a lot.
|
|
|
|
|