I did not see your post before posting mine....i agree with you....the only viable answer so far seems to be that such evaluations are "compiler-specific" but even then I am not able to derive a logic for the output 5 6 6 6 6 7 !!!
After all compilers are not like girl-friends there has to be some logic or rules that determine the output.
All of this "I expected..." and "it should be..." stuff is pointless. Compiler vendors are free to evaluate such expressions as they wish just so long as all side effects of previous evaluations have been performed at each sequence point. In your printf example, the order in which the arguments are evaluated is not specified, but the sequence point means that all of their side effects are complete before printf() is entered.
"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
All of this "I expected..." and "it should be..." stuff is pointless
What I mean to imply here is that based on what I have read/know the output should have been so and so.....So may be my understanding of this concept (of calling convention, sequence points) needs to be brushed up....It *could be* my ignorance on the matter, lets see, I'll read more, do more research and see what's missing
Compiler vendors are free to evaluate such expressions as they wish just so long as all side effects of previous evaluations have been performed at each sequence point.
Expressions....true, but the point here is about "passing variables" and C does specify how to do that: either R-to-L or L-to-R, we can make that selection.
In your printf example, the order in which the arguments are evaluated is not specified,
I did not specify that but I m using the default calling convention under which variables are passed R-to-L
Tht stuff was in MFC and I read all tht already before posting here.I need some solution in win32 sir ji.
Yesterday One guy suggest me lpfnhook and i tried thtt even but tht one is executing while opening dialog but how do i can implement view status on tht procedure tht i equate to lpfnhook.
Please suggest me some solution.
Thx all of u.
The article author solved some difficult problems in order to accomplish that task. MFC or Win32 doesn't really matter: you can easily adapt the MFC stuff to Win32 API. You know, MFC is a thin wrapper around it.
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
C++ isn't something like VB, where you can assign dump anything into any datatype. C++ requires you to know what you're doing.
If the result of your expression is a number, then assign it to a number and then 'store' it into the string with one of those string formatting functions.
int nVal = (6+9)/5-9;
_tprintf(str, _T("%d"), nVal);
You could alternatively write your own string class which does the conversion implicitly for you, by having the appropriate operators overloaded and enabling you to write statements of that sort where you assign an expression to a your string class object.
“Follow your bliss.” – Joseph Campbell
Last Visit: 31-Dec-99 18:00 Last Update: 4-Oct-23 11:01