|
WM_POWERBROADCAST
The WM_POWERBROADCAST message is broadcast to an application to notify it of power-management events. A window receives this message through its WindowProc function.
|
|
|
|
|
Will the declaration __stdcall fun() will use pascal calling convention.
|
|
|
|
|
Are you wanting to know about the __pascal or __stdcall calling convention? The former is no longer supported. Use of the WINAPI macro will resolve to the appropriate calling convention for the target.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
What I want is i would like my c++ fuction to use pascal calling convention? Will __stdcall helps me? Or first of all will it possible
|
|
|
|
|
Anonymous wrote:
What I want is i would like my c++ fuction to use pascal calling convention? Will __stdcall helps me?
I doubt it, since they are nearly opposite of each other in regards to the stack. __stdcall pops arguments from the stack in right-to-left order while __pascal pops arguments from the stack in left-to-right order. See here for more.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Don't you mean pushes arguments on the stack in the order you stated ? Also - I thought the two, _pascal and _stdcall are essentially the same except that _pascal is now obsolete - replaced by _stdcall.
The other difference is that _stdcall functions pop the stack prior to returning while the function caller restores the stack for _cdecl functions which provides support for functions taking variable numbers of arguments.
|
|
|
|
|
Rick York wrote:
Don't you mean pushes arguments on the stack in the order you stated ?
Probably. What gets pushed must eventually get popped! At that level of detail, I'm not sure the OP cared.
With 16-bit code, differences between the two are important. With 32-bit code, __pascal is not used so it effectively resolves to nothing. That's why the WINAPI macro exists.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Will it mean, __stdcall fun(int i, int j) will push i first then j and __cdecl fun(int i, int j) will push j first, then i. In both cases who pushes the parameters to the stack?
|
|
|
|
|
Will it mean, __stdcall fun(int i, int j) will push i first then j and __cdecl fun(int i, int j) will push j first, then i. In both cases who pushes the parameters to the stack?
|
|
|
|
|
I used some assembler files in my project .
But i get following error in my code .
Performing Custom Build Step on ..\Codecs1\Ce\Celpwin.asm
The system cannot find the path specified.
Error executing c:\winnt\system32\cmd.exe.
Please help me.
|
|
|
|
|
Assembly code requires an assembler, which VC++ is not. You can, however, use embedded assembly code via the __asm keyword.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi,
1. I have a function
fun(int &i, int&j){}
when i tried to call fun(++i, i++); it is showing the error " cannot convert parameter 2 from 'int' to 'int &'"
What is the reason
|
|
|
|
|
I'm no C++ guru, but I think I remember reading something about the C++ standard that states if you update the value of a variable more than once in between sequence points, the behavior is undefined and the compiler may treat this case as it wishes.
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
Hi,
Can you please explain what is sequence point.
And one more thing if my function is fun(int&1, int&j, int &k) and if i try to call fun(++i, ++i, i++)
i will get error at 3rd parameter.
It is showing problem for i++ only, not for ++i.
|
|
|
|
|
Anonymous wrote:
It is showing problem for i++ only, not for ++i.
It will show the problem for ++i as well. The reason it doesn't show the error is because the compiler is evaluating the argument right-to-left, and is stopping when it finds one in error - the 3rd one in this case.
Anonymous wrote:
Can you please explain what is sequence point.
A sequence point is a point in the code where all the side-effects up to this point have been evaluated. They occur at the end of a statement, at the comma operator, the && and || operators, and when a function is called after all the arguments have been evaluated. It is at these points that the effects of the ++ and -- operators occur. So in your case, you are modifying the value of i twice within a sequence point (the evalution of the function parameters).
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi Ryan,
But each expression one after the other. So in C/C++
Fun(++i, i++) first i++ will be evaluated and then ++i is evaluated and after that only Fun will be called.
But my surprise is why
int i = 10;
printf("%d, %d, %d", ++i, i++, ++i); will print as 12, 11, 11.
But what I anm expecting is 13, 11, 11.
What is the reason?
|
|
|
|
|
Ranjish wrote:
So in C/C++
Fun(++i, i++) first i++ will be evaluated and then ++i is evaluated and after that only Fun will be called.
No. The order of evaluation of function arguments is undefined. It is not specified by the standard, and the compilers can do whatever they like.
The results of modifying the same variable twice (or even three times) in a function call like you're doing is completely undefined. It's totally random. There is no way you can tell what is going to happen. The compiler doesn't even have to generate correct code for this case. In my opinion, the compiler should flag an error, because it's impossible to work out what should happen. Even in your case when you're expecting 13,11,11 the compiler could legally set every one of them to random numbers, because you're trying to do something undefined.
Basically, do not ever change the value of a variable twice in a single statement. The results are completely undefined, and could be anything.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Both of these operators return an int , not an int& , so you can only pass them to a function expecting an int or a const int& .
Besides, according to the C++ standard, the values passed to your function will be undefined because you are changing a variable value twice between the same sequence points (in the function call). The values will differ depending on which order the compiler evaluates the parameters in; the order is not defined in the standard and is compiler-dependent.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
[edit] Just Googling, I got this from this page: http://cpptips.hyperformix.com/cpptips/inline_seq_pt[^]
the result would either be `1 - 2' OR `2 - 1'. But, it is a safe
operation and the result MUST be one of these two values. Please note
this is very different from code like:
int main() {
int x = 0;
return ++x - ++x;
}
which results in UNDEFINED behavior. This program may return -1, 1,
42, or it may crash. That's because it modifies the same variable in
an expression without an intervening "sequence point". There's a
"sequence point" at the call to a function after evaluating all the
arguments (which is why the first two main() functions are legal).
There's also sequence points at the operators &&, ||, ?, and comma.
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
Because i++ returns an int , not a reference to an int .
But in any event you should never write code like that, because having two side effects working on the same variable in the same line of code leads to undefined behavior.
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
Magnae clunes mihi placent, nec possum de hac re mentiri.
|
|
|
|
|
Hi all,
I need to start an automatic procession of any files apearing in a certain folder.
Of course I can work with a counter, to check the folder every once in a while. But I´m sure there is a more elegant way of programming that.
Does any one know, if there is anything hidden in the winapi or elsewhere, that makes windows notify my client in case of added files?
Or does anybody know, that there is no alternative? That would at least help me feel better
Thanks.
Stefan.
|
|
|
|
|
|
Also check out FindFirstChangeNotification() .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
There's an article right here[^] on CP that discusses this.
'til next we type...
HAVE FUN!! -- Jesse
|
|
|
|
|
I am working on VC++, now I want to search Front Page from windows Registry. But the front page path would not be same for each new version, so i can not fix its path. So please tell me how do i search front page from windows registry.
Thanks in advance.
Regards,
Lavani
|
|
|
|