|
are you from China ?
modified on Monday, August 18, 2008 11:21 AM
|
|
|
|
|
Poor chinese people
Offtopic added:
About your questions above... I think the answers are quite easy... No, No, No and he doesn't care about.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
modified on Monday, December 17, 2007 9:58:04 AM
|
|
|
|
|
George_George wrote: Could you try to compile the simple code when diable language extension please? You will be surprised why f(X() = X()) can compile but f (X()) can not.
I don't have to do it.
Firstly... I use VC++ 6.0 (as I said in many other messages) so this is out of scope for me.
Then... I don't need to do it because I trust on what you say, I mean, if you say it compiles, why should I don't believe you? (Actually, sometimes you should do the same about the answers you get and don't ask 4 extra times to get an asnwer that you actually already got. It seems that you don't trust on the people who answers you, so... If you don't trust them... why to ask?)
George_George wrote: Any ideas or insights to share are appreciated
If you had payed attention to the text inside the answer...
Nelek wrote: I don't know the reason,... (other text)... I don't know why your code compile and pallini's not
I have already said it. The theory of this question is too deep for me. My knowledge is limited, but not my common sense.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
AFAIK, f(X()) doesn't compile because X() doesn't exist long enough (or is optimised away) to be passsed by reference (the X& reference requires a X instance to be initialized) into f(X& x) . f(X() = X()) works because two temporary objects are created; the assignment operator is fired, and a reference to the lhs temporary object is passed into f(X() = X()) .
IMHO, this code only demonstrates temporary objects and has no practical usage. It is like creating two trucks; cloning the features of one truck into the other, using the cloned truck for a bit, and destroying both trucks when done with the cloned one.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
modified on Monday, December 17, 2007 12:32:25 PM
|
|
|
|
|
Thanks George,
I think my original code breaks the C++ rule that non-const reference can not binded to a rvalue (in my case, X() will generate a temporary object instance, which is a rvalue). How do you think of it?
regards,
George
|
|
|
|
|
C++ creates temporary objects in many situations. However, you should avoid such situations whenever possible. Your code only is really inefficient due to that fact, and most C++ programmers won't touch such code with a ten-foot pole. Also, a reference requires initialization; otherwise, the compiler will emit an error.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Thanks for your advice, George!
regards,
George
|
|
|
|
|
Hi Experts,
How could I know that this is file or folder?
|
|
|
|
|
Folders have the Directory bit set in the File Attributes.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
|
Yes, for example -
<br />
BOOL GetFileAttributesEx( LPCTSTR lpFileName, <br />
GET_FILEEX_INFO_LEVELS fInfoLevelId, <br />
LPVOID lpFileInformation <br />
);<br />
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
|
Hello,
i use CListCtrl with virtual list, and i have a problem when i try to scroll down to see other items,
CListCtrl jumps to first, allways if i call .SetItemCount() to actualize list content!!!
Is there any way to solve this, that i can scroll down in CListCtrl?
Thank you for help!
termal
|
|
|
|
|
Hi
please put your code here, when you call setItemCount?
|
|
|
|
|
Hello,
ähm, there is no large code, here a sample:
pList->SetItemCount(hashmap.size());
that ist all!
Now if i want to scroll down to other items the focus jump allways to top of the list, or any other previous selected item, that means if i select item no. 15 and i croll down to item no. 2500, by SetItemCount list jumps again back to previous selected item no.15, if no selection jumps to top!
Now i try to catch a OnLvnBeginScrollListAll(NMHDR *pNMHDR, LRESULT *pResult) but i get a error:
"error C2065: 'LVN_BEGINSCROLL' : undeclared identifier"
The msdn say's that i need to include commctrl.h, i have that and the error is again there!
I use VS2005!
So that is my problem now, maybe you can help me here?
regards
termal
modified on Monday, December 17, 2007 9:38:26 AM
|
|
|
|
|
Solved,
with
SetItemState(iIndex, /*LVIS_SELECTED | */LVIS_FOCUSED, /*LVIS_SELECTED | */LVIS_FOCUSED );
termal
|
|
|
|
|
Hi!
for x64 windows, i don't use inline assembly code.
how do i use an external asm file, to use assembly code in my vc project.
what settings have need the .asm file, in project?
Zo.Naderi-Iran
|
|
|
|
|
Hi All,
Using VC++, i want to add integer value to date.
For example:
date is 17/12/2007, if i add 365 days to this date, the result should be 16/12/2008.
AddDays() function is available in .Net. How to do it using VC++ 6.0?
|
|
|
|
|
What is your date variable type?
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.
|
|
|
|
|
what about CTime and CTimeSpan ?
|
|
|
|
|
Thank you, i got the soln
I am using COleDateTime and COleDateTimeSpan.
COleDateTime d;
COleDateTimeSpan s(2,0,0,0);
d::GetCurrentTime();
d = d + s;
|
|
|
|
|
Can anybody suggest a light weight HTTP parser library(DLL) preferably open source?
|
|
|
|
|
Hi all,
I want to find the number of words in a string. That string only contain whitespace, tab space and the new line character. So I code it as follows.
int numberOfWords = 1;
string st(pBuffer);
for(int i = 0;i <= st.length(); i++)
{
if(pBuffer[i] == ' ')
{
numberOfWords ++;
}
if(pBuffer[i] == '\t')
{
numberOfWords ++;
}
if(pBuffer[i] == '\n')
{
numberOfWords ++;
}
}
cout << "\n" << numberOfWords;
But this code is odd. I mean say there is a whitespace and a tab space are occur with each other. Then the result is wrong. How can I avoid such odd points there.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Eranga Thennakoon wrote: I mean say there is a whitespace and a tab space are occur with each other
Take a look if the character at i-1 and i+1 are valid before increasing the counter.
Eranga Thennakoon wrote: int numberOfWords = 1;
BTW... if you are asking about 2 spaces or 2 tabs together... then you should take care on empty buffer, so start in numberOfWords = 0 :P
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Nelek wrote: Take a look if the character at i-1 and i+1 are valid before increasing the counter.
Or should I check i and i+1. I'll use it and failed.
Nelek wrote: if you are asking about 2 spaces or 2 tabs together
I've change my code as this.
bool isLastCharBlank = true;
int iWordCount = 0;
char * szTemp = szInputString;
while(*szTemp)
{
if ((*szTemp == ' ') || (*szTemp == '\n'))
{
isLastCharBlank = true;
}
else if (isLastCharBlank)
{
iWordCount++;
isLastCharBlank = false;
}
szTemp++;
}
cout << iWordCount;
Since I've use a pointer to the string I can avoid such instances (I mean 2 spaces, 2 tabs, a tab and a space etc)
But now my question is how to avoid multiple new line characters at the end.
I appreciate your help all the time...
Eranga
|
|
|
|