|
|
can any one explain the sequence steps how x value changes.
i.e expand the below expression for easy understanding
x=x++ + ++x + ++x + --x;
printf("%d",x);
y=x++ + ++x + ++x + --x;
printf("%d",x);
printf("%d",y);
I executed this exp in vc++ i got 1st exp values as x=14
and in second exp i got x=4 and y=13.
sorry i got y=13;
|
|
|
|
|
The difference between y = 13 and x = 14 is because of the postfix operator on x, x++
This get evaluated after the result is assigned to y. Simplify the expresion to see what is happening.
x= 4;
x = x++;
x == 5;
x = 4;
y = x++;
x == 5;
y == 4;
4 is assigned to y before x is incremented.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
And you have no other line modifying or reseting "x" ??? Just this code?
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?
|
|
|
|
|
|
Hello everyone,
The prototype of DeleteFile is,
BOOL WINAPI DeleteFile(
LPCTSTR lpFileName
);
I am wondering if the input parameter (string) is multi-byte characters or wide characters, how should I pass them in? Do I need to do any conversions?
thanks in advance,
George
|
|
|
|
|
George_George wrote: BOOL WINAPI DeleteFile(
LPCTSTR lpFileName
);
The input parameter is of type const TCHAR*. TCHAR is defined in winnt.h as WCHAR if UNICODE is defined or char otherwise. My advise is therefore to pass a TCHAR pointer and you can't go wrong.
<br />
LPCTSTR lpFileName = _T( "C:\\Temp\\someFile" );<br />
::DeleteFile( lpFileName );<br />
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Thanks Matthew,
I think in my situation I do not need to care whether I passed multi-byte character or wide character to DeleteFile, since LPCTSTR is adaptive to multi-byte character or wide character according to the settings of UNICODE macro. Right?
regards,
George
|
|
|
|
|
LPCTSTR is a generic-taxt-mapping type:
(1) if your build is UNICODE (_UNICODE symbol defined) then the string is a wide-character one.
(2) On the other hand, if your build in ANSI or DBCS then LPTCSTR is defined as const char * .
N.B.
Visual Studio .NET, as default, targets its builds to UNICODE (Visual Studio 6 has the opposite default behaviour).
Hope that helps
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.
|
|
|
|
|
Thanks CPallini,
I think in my situation I do not need to care whether I passed multi-byte character or wide character to DeleteFile, since LPCTSTR is adaptive to multi-byte character or wide character according to the settings of UNICODE macro. Right?
regards,
George
|
|
|
|
|
Right only if you use generic text mapping strings, as suggested by Matthew Faithfull.
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.
|
|
|
|
|
Thanks CPallini!
What do you mean "generic text mapping"?
regards,
George
|
|
|
|
|
Basically, follow Matthew Faithfull suggestion, for an example, see here http://msdn2.microsoft.com/en-us/library/4t912wf5(vs.80).aspx[^].
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.
|
|
|
|
|
Thanks CPallini,
Good resource.
regards,
George
|
|
|
|
|
Hello masters, I've to do some mathematical operations on Matrices & arrays on large number of elements using C++. I like to mention some of main functions which I've to use - matrix multliplication, matrix inverse, sorting on arrays, Finding min / max from the list / arrays, etc.
I find there are number of libraries on the internet. So that I like to use some maths libraries.
So request you to suggest me the neccessary information about the higher performance maths library.
Thanks & regards,
Shashikant
|
|
|
|
|
The best option is check those libs out and choose the one that has what you need. But I thing there is not any operation you need in the standard "math.h" and "math.lib". Anyways... they are not difficult. Every operation from the list can be solved programmng your own functions with in a short code. I.E.
Matrix Multiplication
double A[M1][N1];
double B[M2][N2];
double C[M3][N3];
void Mult_Matrix (int m1, int n1, int m2, int n2)
{ int i = 0, j = 0, k = 0;
if (n1 != m2)
return;
for (i = 0; i < m1; i++)
{
for (j = 0; j < n2; j++)
{
while (k < n1)
C[i][j] += A[i][k] * B[k][j];
}
}
}
And the rest are to be not difficult. By the way... I have done it in the samplest way. You can give a pointer to your class CMatrix as return, give error messages and so on... It depends on what you need/want to do. Try it and ask if you have problems, we'll help you.
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?
|
|
|
|
|
Thnaks U Nelek,
As per ur suggestion, I had already implemented & verified listed operations, but our client wanna standard libraries about the same. So that I requires the libraries for the same routine.
Client is interested in libraries coz there are lacs of data elements in matrices & we've to operate on it.
So request you to inform me about higher performance math libs.
Thanks & regards,
Shashikant
|
|
|
|
|
Sorry but i can not help you with it. I usually made my own functions, because the most of the times there are always some particularities that made the libs useless for me. So I don't know much about libs and so on.
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?
|
|
|
|
|
Why not use MATLAB. You can integrate MATLAB very well with C/C++.
There are only two kinds of people who are really fascinating-people who know absolutely everything, and people who know absolutely nothing.
Oscar Wilde (1854-1900)
Regards...
Shouvik
|
|
|
|
|
Dear Sir,
Thanks for suggestion.
With regards,
Shashikant
|
|
|
|
|
Check MTL (Matrix Template Library)
Check TNT and JAMA
Hope this helps
|
|
|
|
|
Dear Sir,
Thanks for suggestion.
With regards,
Shashikant
|
|
|
|
|
Do you have a URL for the MTL? My google search found lots of academic bits talking about it, but not the home itself.
I've rolled my own, but it would be good to have an external one for use too.
Iain.
|
|
|
|
|
Dear Sir,
Thanks for suggestion.
With regards,
Shashikant
|
|
|
|
|