|
True. But the Standard Calling Convention for C is right-to-left.
The output 7 6 6 6 6 5 does not seem to be correct even if you were to pass the values left to right 
|
|
|
|
|
I dont see anything wrong with the output?
++i,j++,i++,++j,++i,j++
1. j++ = 5
2. ++i = 6
3. ++j = 6
4. i++ = 6
5. j++ = 6
7. ++i = 7
You can read more about it here Calling Conventions Demystified[^]
Regards,
Sandip.
|
|
|
|
|
Your example is wrong!
I dont see anything wrong with the output?
++i,j++,i++,++j,++i,j++
1. j++ = 5 true -> j = 5 but after this statement j=6!
2. ++i = 6 true
3. ++j = 6 wrong -> j=7!
4. i++ = 6 true, but after this statement i=7!
5. j++ = 6 wrong -> j=7!
7. ++i = 7 wrong -> i = 8
So the final result is:
8 7 6 7 6 5
Thats also the right compiler result!
|
|
|
|
|
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.
|
|
|
|
|
Covean wrote: Your example is wrong!
I dont see anything wrong with the output?
++i,j++,i++,++j,++i,j++
1. j++ = 5 true -> j = 5 but after this statement j=6!
Please Try following sample
int i=5;
printf("%d %d %d %d %d %d",i++,i++,i++,i++,i++,i++);
According to you what should be the output?
11 10 9 8 7 6 5?
With VS 6.0 the output is
5 5 5 5 5 5
i++ is post increment and will be executed after execution of printf.
Please correct me if i am wrong?
Regards,
Sandip.
|
|
|
|
|
Can you please look at the asm-code your compiler generates cause my compiler answers your question in the correct way.
|
|
|
|
|
I will surely read the article, i see a lot many interesting points there.
But before that, just a little curious,
1. j++ = 5 //OK. Printed value is 5, after that it becomes 6
2. ++i = 6 //OK. First i is incremented to 6 then printed out
3. ++j = 6 //Incorrect.j will first be incremented then printed out. But note that present value of j is 6 (from step 1). So j at this stage becomes 7.
4. i++ = 6 //OK. i now is 7 after printing
5. j++ = 6 //Incorrect. Should have been 7
6. ++i = 7 //Incorrect. Should have been 8
Just to make things a little simpler
i = j = 5;
printf("%d %d %d\n",i++,i++,i++);
printf("i %d\n",i);
Now the output is:
5 5 5
i 8
Even if the beahviour is compiler-specific how do you interpret this example (or even the first one)?
|
|
|
|
|
Please check my other reply for answer.
Regards,
Sandip.
|
|
|
|
|
I cant believe the output:
5 5 5
I tried your code and it says "7 6 5". What is right.
And the 8 7 6 7 6 5 from the prev. problem i also said that
the compiler output is correct.
|
|
|
|
|
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
|
|
|
|
|
DavidCrow wrote: 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
DavidCrow wrote: 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.
DavidCrow wrote: 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
|
|
|
|
|
Hello Everyone,
i am trying to Extract the Contents of the HTML page from the Table Tag.
Till now i have done with identifying the Table tag from the Html Page.
but still i am not able to extract the data from the table tag.
can anyone please help me with this.
I am getting the output as 0.
MSHTML::IHTMLDocument2Ptr pDoc;
MSHTML::IHTMLDocument3Ptr pDoc3;
MSHTML::IHTMLElementCollectionPtr pCollection;
MSHTML::IHTMLElementPtr pElement;
HRESULT hr = CoCreateInstance(CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER,IID_IHTMLDocument2, (void**)&pDoc);
hr = pDoc->write(psa);
hr = pDoc->close();
pDoc3 = pDoc;
pDoc->get_all(&pCollection);
pCollection = pDoc3->getElementsByTagName("table");
BSTR itxt;
for(long i=0; i<pCollection->length; i++){
pElement = pCollection->item(i, (long)0);
if(pElement != NULL){
m_wndLinksList.AddString((LPCTSTR)bstr_t(pEle->get_innerText(&itxt)));
}
}
|
|
|
|
|
NaveenHS wrote: pCollection = pDoc3->getElementsByTagName("table");
Does pCollection have a non-NULL value?
"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
|
|
|
|
|
hello friends
Do anyone of u know tht how i can use lpfnhook of OPENFILENAME to save view setting of dialog.
Thanks & Regards
Yogesh
|
|
|
|
|
Hello.
Yesterday David Crow posted a link to a wonderful article about using that stuff. Did you read 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
[My articles]
|
|
|
|
|
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
[My articles]
|
|
|
|
|
I agree with u tht MFC is thin wrapper around win32.But i hv no idea abt MFC really,so only i was asking.
Anyway,Thx for ur valuable time for my posts.
Regards
Yogesh
|
|
|
|
|
yogeshs wrote: I agree with u tht MFC is thin wrapper around win32.But i hv no idea abt MFC really
Just handle messages the way the article's author did, using your hook procedure and Win32 API .
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
[My articles]
|
|
|
|
|
yogeshs wrote: I agree with u tht MFC is thin wrapper around win32
yogeshs wrote: i hv no idea abt MFC really
Thanks. The weather today is really depressing (dark, rain). I needed this to cheer me up.
By the way, you seem to have some sort of keyboard malfunction:
yogeshs wrote: u tht
yogeshs wrote: i hv
yogeshs wrote: Thx
yogeshs wrote: ur
yogeshs wrote: abt
|
|
|
|
|
|
Michael Schubert wrote:
By the way, you seem to have some sort of keyboard malfunction:
Sadly, I think the keyboard is doing exactly what it was instructed to do.
"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
|
|
|
|
|
How Can I evaluate an axpression in string ?
for example :
string x = "(6+9)/5-9";
string y = "Ln(10)+cos(30)-55";
How Can I evaluate that in visual studio ?
Is there a FREE parser that does these operations ?
I'm using vb 6
|
|
|
|
|
fcis2008 wrote: string x = "(6+9)/5-9";
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;
TCHAR str[42];
_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
|
|
|
|
|
Rajesh R Subramanian wrote: C++ isn't something like VB, where you can dump anything into any datatype. C++ requires you to know what you're doing.
Well said! Take 5.
|
|
|
|