|
Firstly there are two cases here, the pre-increment and (++i ) the post-increment (i++ ). The pre-increment case increments the variable and returns a reference to it. The post-increment case copies the variable, increments the original and returns the copy.
Steve
|
|
|
|
|
To reinforce what Richard said, while this is cute, it's always counterproductive. It's so subtle that even if you KNOW what you're doing, you're going to screw it up and in a production environment, you're going to confuse someone who's not was good with obfurscated code as you think you are. Just write it out in the clearest possible terms and let the compiler worry about optimizing it these days. The compiler can do optimizations that would curl your hair if you looked at what it was doing.
Once you agree to clans, tribes, governments...you've opted for socialism. The rest is just details.
|
|
|
|
|
Hi all
i have been experimenting with CAsyncSocket and have derived my own class. I am able to connect a client to a server app that I have written (VC6) and all is working well.
My first question is why does the server have to accept on another socket?
My second question is if the server is to be designed to accept 64 clients connecting to it, does that mean I need to define 128 sockets
Thanks for having a look at this!
Regards
Mike
|
|
|
|
|
MikeRWinter wrote: My first question is why does the server have to accept on another socket?
TCP is a connection oriented protocol, the server needs to accept the connection and a handshake is performed before further communication will be possible (which is part of TCP's reliable data transfer). On the other hand, if you are working with UDP, which is not connection oriented, you don't have to call accept(), sockets can just send data when they feel like (which could also mean nobody is listening to them).
MikeRWinter wrote: My second question is if the server is to be designed to accept 64 clients connecting to it,
Where does this limit come from, not sure what you mean?
/Moak
|
|
|
|
|
Greetings,
I am trying to populate a CTabCtrl in my dialog with child dialogs but I am having terrible problems with inheritance of the CWnd*.
Now I assume that is what it is as the dialogs I create are spawning in their own window rather than the client window of the control. Below is snippet of my class
CTabManage::CTabManage()
{
m_tab[0]=new CDetails;
...
void CTabManage::Init()
{
m_tabActive=0;
m_tab[0]->Create(IDD_TAB_DETAILS, this);
...
and here is where it is initialised
::OnInitDialog()
...
m_cTabManage.InsertItem(0, _T("Details"));
m_cTabManage.Init();
...
Any pointers would be appreciated as it has been driving me nuts.
Alan
|
|
|
|
|
Is the WS_CHILD set for you child dialogs? In the resource properties for your dialogs make sure Style=Child , and you probably would like Control=True as well.
|
|
|
|
|
Thank you. That got it.
That was the one thing I had not checked.
Alan
|
|
|
|
|
Hi everyone,
Can anyone tell me how to convert a vector (of doubles) to a variant?
I am receiving the following error message from vc++ 2008:
error C2664: 'CiPlotChannelX::AddXYArrays' : cannot convert parameter 1 from 'std::vector<_Ty>' to 'const VARIANT &'
I have close to 1 million values so I'm trying to avoid any "for" loops.
Thanks!
|
|
|
|
|
Never needed to do this but i read somewhere that you can use CComSafeArray[^] to get a variant, or something that you can use with variant from an array. I think you need to wrap your array into this CComSafeArray thing (it is a template i believe) and then use Detach or maybe it's LPSAFEARRAY operator to get a SAFEARRAY wich can be used with VARIANT.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers don't kill programs, users kill programs <
> "It doesn't work, fix it" does not qualify as a bug report. <
|
|
|
|
|
ok, thanks. I'll look into this.
|
|
|
|
|
I have created a custom class to draw radio button and I am able to create it using the class object, but I want to imiplement group property on the radio button.
Can anybody please help me in this regards.
Thanks....
|
|
|
|
|
You should be a tiny bit more specific than that...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers don't kill programs, users kill programs <
> "It doesn't work, fix it" does not qualify as a bug report. <
|
|
|
|
|
I have a class CCustomRadioCtrl which is derived from cbutton with radio button style. using the object of my custom class I can create radio button, I am not able to set the group property of the radio button if I hv more then one radio control, So that one can be selected at a time.
|
|
|
|
|
What do you mean by "not able to set it"? You use something like ::SetWindowLong(hRadioBtn, GWL_STYLE, ::GetWindowLong(hRadioBtn, GWL_STYLE) | WS_GROUP) but it gives you an error code? You can't set the group style in the resource editor? You can set it but it just does not work? If it is the later one, what happens? Is your radio owner-drawn (has the BS_OWNERDRAW) style? If no, then i guess BS_AUTORADIOBUTTON should make it work. If yes, then, since according to the documentation[^] BS_OWNERDRAW can't be combined with anything else, you will have to provide this functionality manually. You can try using CheckRadioButton[^], i don't know if it works for owner-drawn buttons or not. Other than that what you can do i guess is use GetNextWindow[^] to walk the controls around the radio that has been clicked and find the other radios inside the same group and check/uncheck them.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers don't kill programs, users kill programs <
> "It doesn't work, fix it" does not qualify as a bug report. <
|
|
|
|
|
Can you send me some sample code, please ?
|
|
|
|
|
Of what?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers don't kill programs, users kill programs <
> "It doesn't work, fix it" does not qualify as a bug report. <
|
|
|
|
|
Hi!
I got the following compiler error.
error C2491: 'CEGUI::IrrlichtRenderer::d_rendererID' : definition of dllimport static data member not allowed
I've not imported any dlls. I've declared the variable "d_rendererID" in the header file as static with a
protected access specifier.
static String d_rendererID;
and I'm defining it in the source file like this:
String IrrlichtRenderer::d_rendererID("CEGUI::IrrlichtRenderer "
"- Official Irrlicht based 2nd generation renderer module.");
What is the thing that prevents the definition of this variable? How do I resolve?
|
|
|
|
|
All error codes can be found on MSDN with a better description -> C2491[^]
What is String? A class or a #define?
#define String __declspec(dllimport) std::string
could result in such error.
|
|
|
|
|
hi i want to open and play a video file in pocket pc 2003 using vc++.
please any idea any sample code which will help me.
|
|
|
|
|
|
Hi!
I got this error when I compile m y project.
error C2664: 'irr::video::ITexture *irr::video::IVideoDriver::addTexture(const irr::core::dimension2d<T> &,const irr::io::path &,irr::video::ECOLOR_FORMAT)' : cannot convert parameter 1 from 'irr::core::dimension2d<T>' to 'const irr::core::dimension2d<T> &'
1> with
1> [
1> T=irr::u32
1> ]
1> and
1> [
1> T=irr::s32
1> ]
1> and
1> [
1> T=irr::u32
1> ]
1> Reason: cannot convert from 'irr::core::dimension2d<T>' to 'const irr::core::dimension2d<T>'
1> with
1> [
1> T=irr::s32
1> ]
1> and
1> [
1> T=irr::u32
1> ]
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
How do I resolve this error?
|
|
|
|
|
Please don't post the error message as code, it becomes unreadable.
Could you also post some part of the code where the error occured?
By looking at the error, it seems you are trying to pass a dimension2d<u32> to a function accepting a dimension2d<s32>. With template objects, there's no automatic conversion even if a u32 can be converted to a s32 automatically. These templates are two different objects which cannot be interchanged.
You have to work with a dimension2d<s32> instead of a dimension<u32>.
EDIT: fixed the HTML tags
|
|
|
|
|
Here is the line that causes the error.
d_texture = d_driver.addRenderTargetTexture(
irr_sz, IrrlichtTexture::getUniqueName().c_str());
irr_sz is the argument of type
irr::core::dimension2d<irr::s32>
Compiler says can't convert the above type to const irr::core::dimension2d<T>
What to do?
|
|
|
|
|
Sorry, the < and > symbols were removed in my previous reply. This is fixed, and I explained what you have to do.
|
|
|
|
|
I have been asked this question in my recent interview...
"How can we make sure that only one thread access global variable?"
What's the appropriate answer.
Thanks all
|
|
|
|