|
Without testing it, I'd say it won't time out. Some value has to be used as INFINITE , and the maximum unsigned value is a good choice. Writing the code so that it never expires isn't difficult; it's not like something is going to wake up and decrement it every millisecond.
|
|
|
|
|
0xFFFF is a value which is literally NOT "passed". That is, it's something like a zero ("0") used in the BIOS that a user can select/type as input which, under advanced CPU settings for example, signals that "ALL" cores are to be used (say there are 16 cores). Which is not to say that 1, 2, 3, 4, etc cores can take zero's place in the control for the specific input value.
It seems contrary to common sense use that a real value can be used to represent a ceiling or a floor as such but when it is the case, generally there's a typed message/note to the substitution next to such a control.
|
|
|
|
|
Quote: But when I checked the #define value of the INFINITE, it is 0xFFFF. Probably you meant 0xFFFFFFFF .
That said, the documentation is clear: if you pass INFINITE (0xFFFFFFFF ) then the function shall wait forever (not 2^32-1 milliseconds). So it just depends on how much you trust the documentation.
|
|
|
|
|
You are right 8 Fs are there as it is a 32 bit value.
Quote: So it just depends on how much you trust the documentation.
Quote Selected Text
Yes, As the api source is not open source, Is there any minor possibility of having it blocked for 49 days..... Probably we can check it by debugging the api in assembly code.
I am just doubting if microsoft has passed the timeout value to the internal generic logic considering the user will never keep itself block for 49 days ....
Prafulla Vedante
|
|
|
|
|
Generally speaking, I trust their documentation.
|
|
|
|
|
PrafullaVedante wrote: considering the user will never keep itself block for 49 days ....
I have. Code starts and a section of it waits for a global shutdown object to be signaled. (That aside, I believe Raymond Chen has confirmed that INFINITE really is infinite.)
|
|
|
|
|
Supose two matrices are there a[3][3] and b[3][3] we scanned the element in a[][] matrix and b is the transpose of former . NOW
when we write a code to assign the values we use
for(i=0;i<3;i++)
{for(j=0;j<3;j++)
b[i][j]=a[j][i];
}//correct
but when we do b[j][i]=a[i][j] it gives a wrong result why? since in both the cases all assigning cases are same.
|
|
|
|
|
This should be very easy to trace in a debugger. You don't even tell in which way the result is wrong, and you do not show the declaration to fhe two matrices, so there is really not much information to make a qualified guess.
|
|
|
|
|
Of course the result must be the same. Try
#include <iostream>
using namespace std;
void transp_v1( char tgt[3][3], char src[3][3] );
void transp_v2( char tgt[3][3], char src[3][3] );
void dump( char m[3][3] );
int main()
{
char a[3][3] =
{
{ 'a', 'b', 'c' },
{ 'd', 'e', 'f' },
{ 'g', 'h', 'i' },
};
char b[3][3];
char c[3][3];
transp_v1( b, a);
transp_v2( c, a);
dump(a);
cout << "--------\n";
dump(b);
cout << "--------\n";
dump(c);
cout << "--------\n";
}
void transp_v1( char tgt[3][3], char src[3][3] )
{
for (int i=0; i<3; ++i)
for (int j=0; j<3; ++j)
tgt[i][j] = src[j][i];
}
void transp_v2( char tgt[3][3], char src[3][3] )
{
for (int i=0; i<3; ++i)
for (int j=0; j<3; ++j)
tgt[j][i] = src[i][j];
}
void dump( char m[3][3] )
{
for (int i=0; i<3; ++i)
{
for (int j=0; j<3; ++j)
cout << m[i][j] << " ";
cout << "\n";
}
}
output:
a b c
d e f
g h i
--------
a d g
b e h
c f i
--------
a d g
b e h
c f i
--------
|
|
|
|
|
but as per my code its giving wrong result whats wrong with my code
i tested many times
void main(){
int a[3][3],b[3][3],i,j;
for(i=0;i<3;i++)
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
for(i=0;i<3;i++)
{for(j=0;j<3;j++)
{printf("%d ",a[i][j]);
}
printf("\n");
}
for(i=0;i<3;i++)
{for(j=0;j<3;j++)
{b[j][i]=a[i][j];
printf("%d ",b[i][j]);
}
printf("\n");
}
}
|
|
|
|
|
Your code is wrong because you are printing the b matrix while you're updating it (you are printing 'not yet updated' items).
Try
#include <stdio.h>
int main()
{
int a[3][3],b[3][3],i,j;
for(i=0;i<3;i++)
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("%d ",a[i][j]);
}
printf("\n");
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
b[j][i]=a[i][j];
}
printf("\n");
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("%d ",b[i][j]);
}
printf("\n");
}
return 0;
}
|
|
|
|
|
b[j][i]=a[i][j];
printf("%d ",b[i][j]); So you wanted to print the value of b[i][j] after you updated b[j][i]?
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
How to draw a realtime XY plot in MFC.
I have an existing MFC application in which there are many tags that changes continuously.
I have to show the value of 2 tags which changes dynamically. I have to plot an XY plot for the tags in a separate dialog or window in the existing MFC application.
Please suggest me some easiest or quickest ways of doing the above task.
|
|
|
|
|
Well the Microsoft Scribble sample would be a good start.
|
|
|
|
|
I remember trying to learn MFC with that back in 1992.
|
|
|
|
|
|
|
There are many good articles about drawing in mfc - which is really pretty much Win32. Rather than have that magical moment where you get it running and it flickers constantly, make sure to look into double buffering with a bitmap.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
How do you generate random numbers in C++? I C# I had to use a seed and set some range limits/boundaries.
.
modified 2-Jun-20 3:21am.
|
|
|
|
|
|
|
|
A google search would have found the answer quicker than it takes to open a question here. Please try doing a bit of research first.
|
|
|
|
|
k, I`ll keep that in mind next time I post. I still believe in learning by human interaction though.
https://web.facebook.com/pin46/
modified 2-Jun-20 11:12am.
|
|
|
|
|
Keep it in mind before you post. And if you really want to learn a language there are many useful books and tutorials you can make use of.
|
|
|
|