|
Thank you so much perterchen, Now I will sit on work on your explanation . Thanks a lot
|
|
|
|
|
Your example was so nice, realy useful. thanks a lot man. And I tried another simple thing, but why do I get this error peter?
template<class T> class Key
{
T k;
T* kptr;
int length;
public:
Key(T);
};
void main()
{
Key < int > i;
}
: error C2512: 'Key<int>' : no appropriate default constructor available
*
|
|
|
|
|
If a coworker asked me that, I'd start with a "questions" game: What does the compiler say? Where does it saay that? etc. - you could work this out yourself
since you declare Key(T), the default constructor Key() is not generated automatically.
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers! We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP Linkify!|Fold With Us!
|
|
|
|
|
oops, just a simple mistake. I'm taking up templates with an assumption it's too difficult to understand. So any error it throws look big for me . Sorry peter, it's the usual "no definition" error. Damn, I should have put Key(T){}. Now I defined it inline. Sorry for the stupid question. And Btw, next time if I come up with a good question would you try to extend your support? please?
*
|
|
|
|
|
No problem I just want to encourage you to help yourself.
Astricks wrote: And Btw, next time if I come up with a good question would you try to extend your support? please?
No promise, but you aren't on a black list or something
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers! We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP Linkify!|Fold With Us!
|
|
|
|
|
peterchen wrote: No problem I just want to encourage you to help yourself.
Thanks peter .
peterchen wrote: you aren't on a black list or something
pheww!
*
|
|
|
|
|
Environment:
Windows XP Professional 32-bit
Visual Studio C++ Express Edition 8.0 SP2
Platform SDK Windows 2003 Server RC2
Project: C++, Windows 32-bit (x86), Debug, Unicode
<br />
Compiling...<br />
Dialog.cpp<br />
d:\lbm\bdm\dialog.cpp(43) : warning C4244: 'argument' : conversion from 'LONG' to 'LONG', possible loss of data<br />
[rest of compilation continues]<br />
The code triggering the warning message:
#ifdef _WIN64
SetWindowLongPtr(hdlg, DLGWINDOWEXTRA, (LONG_PTR)(wcDlgInfo->m_wcDlgProc));
#else
SetWindowLongPtr(hdlg, DLGWINDOWEXTRA, (LONG __w64)(wcDlgInfo->m_wcDlgProc));
#endif
Normally the line
SetWindowLongPtr(hdlg, DLGWINDOWEXTRA, (LONG_PTR)(wcDlgInfo->m_wcDlgProc));
would suffice, but this also complains about the conversion of LONG_PTR to LONG, as if LONG_PTR is 64-bit:
Compiling...
Dialog.cpp
d:\lbm\bdm\dialog.cpp(47) : warning C4244: 'argument' : conversion from 'LONG_PTR' to 'LONG', possible loss of data
Any ideas why
- LONG_PTR is considered "larger" than LONG on 32-bit x86, and
- what means exactly the "conversion from LONG to LONG" warning message means, since _WIN64 is not defined?
Many thanks,
Cristian Amarie
|
|
|
|
|
I'm not sure about the error message, but...
Cristian Amarie wrote: but this also complains about the conversion of LONG_PTR to LONG, as if LONG_PTR is 64-bit
A LONG_PTR IS a 64-bit value in a 64-bit build. That's the whole reason for the newer type. It's
a LONG but large enough to hold a pointer when pointers are 32-bit or 64-bit.
I'm not sure what a "LONG __w64" is, but this line...
SetWindowLongPtr(hdlg, DLGWINDOWEXTRA, (LONG __w64)(wcDlgInfo->m_wcDlgProc));
...won't work on a 32-bit build because pointers are 32-bit therefore you need to pass a 32-bit
value. Sure, you can cast a 64-bit but it's going to be truncated to 32-bits.
Mark
|
|
|
|
|
[A LONG_PTR IS a 64-bit value in a 64-bit build]
True, but as I stated in environment, is a 32-bit build.
[I'm not sure what a "LONG __w64" is, but this line...]
(Microsoft Specific) Lets you mark variables, such that when you compile with /Wp64 the compiler will report any warnings that would be reported if you were compiling with a 64-bit compiler.
Is a "marker".
About the last part of message, true, but (LONG __w64) was on #else part of #ifdef _WIN64.
|
|
|
|
|
Hmm
What type is wcDlgInfo->m_wcDlgProc?
|
|
|
|
|
typedef LRESULT (CALLBACK *WCDLGPROC)(HWND, UINT, WPARAM, LPARAM);
m_wcDlgProc is a pointer (to a window procedure).
|
|
|
|
|
Yeah that's a good WTF
This...
::SetWindowLongPtr(hdlg, DLGWINDOWEXTRA, (LONG)(LONG_PTR)(wcDlgInfo->m_wcDlgProc));
..."fixes" it on VS2003.
I'd call that a bug, but every time I do, someone has a good reason for the behavior
|
|
|
|
|
Now that's a stretch (Dad to DeeDee - Dexter's Laboratory)
|
|
|
|
|
Cristian Amarie wrote: Normally the line
SetWindowLongPtr(hdlg, DLGWINDOWEXTRA, (LONG_PTR)(wcDlgInfo->m_wcDlgProc));
would suffice, but this also complains about the conversion of LONG_PTR to LONG, as if LONG_PTR is 64-bit:
I aggree with you. This should suffice. About warning, probably this could be issue with IDE.
|
|
|
|
|
Hello,
I have 2 times which I would like to subtract.
One time is a time that consists of hours, minutes, seconds and milliseconds. For instance 12:24:59.0.
and the other time is a timer which consists only of milliseconds, seconds and minutes (no hours). For instance: 4.52.300.
The problem is that I need to subtract the two times and get a result which also contains the difference in milliseconds (this is critical for the timer).
I tried converting both times to COleDateTime, then subtracting them but I don't get the result in Milliseconds, so I lose information.
By the way, I have both times in SYSTEMTIME format but is there a function that subtracts them?
Any other ideas?
|
|
|
|
|
SWDevil wrote: By the way, I have both times in SYSTEMTIME format but is there a function that subtracts them?
Convert SYSTEMTIME to FILETIME using SystemTimeToFileTime . Convert FILETIME to ULARGE_INTEGER and use it for artimetic operations.
|
|
|
|
|
I would like to use a vector to hold a large volume of data. So, I conducted a test with std::vector. However, the value of 'Sum' is 16677720, instead of 100, 000, 000. However, i can get the value 100, 000, 000 when declare 'Sum' as unsigned int type. Why? My pc has 32-bit bus address.
<br />
vector <float> DDD;<br />
<br />
DDD.reserve.((10000 * 10000)/2*6)<br />
<br />
float x= (float)1;<br />
for(int i = 0; i < (10000 * 10000); i++)<br />
{<br />
DDD.push_back(x);<br />
}<br />
float Sum = 0;<br />
for(int j = 0; j < (10000 * 10000); j++)<br />
{<br />
Sum += DDD[j];<br />
}<br />
|
|
|
|
|
The problem is with using a float, not 32 bit integers.
Your floats only have a precision of 7 digits. If you must use a floating point value then at
least use a double
|
|
|
|
|
Which function similar to GetTickCount() to get time in us (1/1000 ms) level?
|
|
|
|
|
You want microsecond (1/1000 msec) resolution? If so, that's not possible.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
GetSystemTime contains all up to milliseconds.
|
|
|
|
|
|
great!
QueryPerformanceCounter() works perfect!
It is really impossible if you are not good enough.
|
|
|
|
|
Hello!
I use Visual Studio 2005 SP 1. Here it a part of my code:
CStdioFile fd;
CString t;
fd.Open(_T("rep.txt"), CFile::modeRead, 0);
fd.ReadString(t);
This file contains the russian language and when I use debugger I see that 't' contains is 'm_pszData 0x003BBA60 "CSAD|Air Tube (òðóáêà äëÿ îòâîäà òåïëà îò ïðîöåññîðà)|2" wchar_t*'
You see, that russian part is unreadable. My project has Unicode libraries support and I can use Russian in my project, but 'Read string' has the problem. Can you help me?
|
|
|
|
|
yaros21 wrote: ...when I use debugger I see that 't' contains is 'm_pszData 0x003BBA60...
Are you viewing it with the "su" debugger symbol?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|