|
For gcc-3.3 compiler's Optimization function, who can provide some c source code for each optimize Options?
And provide more introduction resources for -O2 option.
Thank you!
|
|
|
|
|
Some source code compiled by gcc-3.3 running exception when using -O2 option, running OK while no using -O2 option.
|
|
|
|
|
My app needs a window to appear on top of all existing windows on the desktop. I have therefore coded :-
CAlarmEndDlg dlgEnd;
dlgEnd.SetTime(szTime);
dlgEnd.SetWindowPos(&wndTopMost,60,80,0,0,SWP_NOSIZE);
dlgEnd.DoModal();
However, on compiling I get :-
D:\Programming projects\MyAlarm\MyAlarmDlg.cpp(219) : error C2065: 'wndTopMost' : undeclared identifier
I have found wndTopMost in wincore.cpp
const AFX_DATADEF CWnd CWnd::wndTopMost(HWND_TOPMOST);
which appears to be some sort of data definition (of which I'm not familiar) but why is this not being picked up during compilation ?
Any help would be appreciated !
Doug
|
|
|
|
|
If this code is outside a CWnd object (which is probably the case), you should try this:
CAlarmEndDlg dlgEnd;
dlgEnd.SetTime(szTime);
dlgEnd.SetWindowPos(&CWnd::wndTopMost,60,80,0,0,SWP_NOSIZE);
dlgEnd.DoModal();
|
|
|
|
|
DougButtimer wrote: dlgEnd.SetWindowPos(&wndTopMost,60,80,0,0,SWP_NOSIZE);
Use dlgEnd.SetWindowPos(&CWnd::wndTopMost,60,80,0,0,SWP_NOSIZE); instead.
|
|
|
|
|
Thanks for both replies !! Yes, the use was within a global function (Timer callback) and the use of CWnd:: has cured the problem. Just given myself a smacked hand for not trying that before posting the cry for help !! Thanks again !
Doug
|
|
|
|
|
Hi,
Hope I am not asking a stupid question
But since notification of say receive or send is done via messages
Is there a Windows Based message to go with Virtual Function say
OnReceive e.g. WM_SOCKET_RECEIVE
and its user based message that the Server sends What if the Server is
a non Windows/DOS BASED computer
|
|
|
|
|
Notification of send or receive is done by the CAsyncSocket class using the OnReceive virtual function. If you don't use this class you will not get any notification. It would simply be the send /recv or WSASend /WSARecv function calls. CAsyncSocket class probably uses these functions internally.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
In otherwords the DLL used by AfxSockinit
on a Send From (the Server on the Some other machine/Computer)
would know to call CASycSocket::OnReceive ???
(I have been able to send messages using the WinSock/SDK "C" api's )
So in other words there aren't any message map entries necessary for
OnReceive
thankx again
|
|
|
|
|
consider the below code
class ab
{
public:
virtual void foo(int a = 2) = 0;
};
class ba : public ab
{
public:
void foo(int a = 4){std::cout<<a;}
};
int main()
{
ba tst;
ab &tst1 = tst;
tst1.foo();
}
this will print me 2 i.e base class signature is used so is default arguemts are resolved during complie time or runtime and why is the above doing so { but i was excepting it to be 4 (derived default)}
|
|
|
|
|
Default arguments are resolved at compile time. (This is by necessity to build the stack correctly prior to the call. Thus, once a virtual function is called through the vtable, the call stack must already be set up.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
joe,
but y is it sets the argument to base function signature arguments..
|
|
|
|
|
Because that's all it "knows" about. The use of the virtual function isn't done (or technically "known") until runtime.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
The C++ standard says this about default arguments (in section 8.3.6 para 10):
10 A virtual function call (10.3) uses the default arguments in the declaration of the virtual function determined by the static type of the pointer or reference denoting the object. An overriding function in a derived class does not acquire default arguments from the function it overrides.
Note the use of static type of the pointer or reference - the static type of your reference is a reference to the base type, so it uses the base type's default parameter value.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
hi if using sizeof function will this be resolved during
1. runtime
2. compile time
3. pre-compile time
please give me answers
|
|
|
|
|
sizeof() is not a function, but a compile time operator. (Amazingly enough Google gives that answer as the second hit.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Have you tried to figure this out for yourself ? Most compilers can write their preprocessor output and this would tell you.
|
|
|
|
|
York,
can u hint how to do it..
plz..
|
|
|
|
|
One way to see this is to have the compiler generate machine and assembly source (in output, depending on the compiler.) If you don't understand assembly, though, it may not do much good.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
If you are using Microsoft compiler,
Take a look its (CL.EXE) options - cl.exe /?
-PREPROCESSOR-
/AI<dir> add to assembly search path /FU<file> forced using assembly/module
/C don't strip comments /D<name>{=|#}<text> define macro
/E preprocess to stdout /EP preprocess to stdout, no #line
/P preprocess to file /Fx merge injected code to file
/FI<file> name forced include file /U<name> remove predefined macro
/u remove all predefined macros /I<dir> add to include search path
/X ignore "standard places"
|
|
|
|
|
|
rrc.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
A simple linked list. Do something with the first, then move the first to the end (don't forget to update the pointers). Repeat to achieve round robin. Three words aren't going to get you any code - be specific and understand that this is not RentACoder; chances are you'll get helpful hints, not complete solutions
|
|
|
|
|
rainbow trout
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
How to let an SDI-Appliction automatically scroll to present the last line of very long text in the output?the class used hier is CEditView.
|
|
|
|