|
What is the value of c ? Does it point to a valid memory address ?
Otherwise your method could simply return NULL and you didn't check it.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
c isn't null. c contains a valid memory address and according to the Visual Studio debugger it contains the addresses of virtual functions.
The same source is working when compiled with GCC.
The difference may be is in the calling conventions or i don't know.
But there is no problem in the source.
The problem is in the dll that is used i think.
|
|
|
|
|
Hey guys
I was wondering why you use
typedef Handle ****Handle;
What does it exactly do??
I'm sorry guys, I didn't mean *** to be a pointer rather a dummyname
typedef Handle ObjectHandle
This is what I meant
-- modified at 11:10 Thursday 29th June, 2006
|
|
|
|
|
It's a pointer to a pointer to a pointer to a pointer to a Handle
are you certain that's the way it is written ? because typedefing with the name name should not work.
In what context is it used ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
It is used in RTI (Runtime Infrastructure)
|
|
|
|
|
Is this real code?
Quite a few indirections to itself!
Best,
Jun
|
|
|
|
|
Yeah it is actually used in RTI to call upon different federates
Im not sure if u are familiar with RTI.
What it does is, interacts with multiple simulations which the simulations interacting with each other. Its more like a third party.
|
|
|
|
|
A little bit, but I haven't done anything seriously yet. I don't like SOM/FOM stuff.
Are you developing a HLA federation now? It's quite a lot of effort from my understanding. Which vender's RTI are you using, VTC, MAK, PITCH, etc?
Best,
Jun
|
|
|
|
|
Some of us use it in very rare situations like this:
struct Handle
{
};
struct Handle2
{
typedef Handle ****Handle;
};
-- modified at 10:41 Thursday 29th June, 2006
It means that within Handle2 , Handle will be a pointer to a pointer to a pointer to a pointer which points to a value of first structure.
|
|
|
|
|
|
Probably Handle name is used for some convenience, or maybe to hide the original meaning of Handle .
|
|
|
|
|
Yeah, that's correct. However, I'm wondering:
- where need so many levels of indirection?
- wouldn't be better to change anyhow the defined type name to be clearer for anybody what's there?
Ovidiu
|
|
|
|
|
I think we should ask the authors of RTI, where such weird constructions are used, according to Jay03 message.
|
|
|
|
|
It is a very poor way to declare a new type. The reason it is poor is because of the naming. The goal it is trying to accomplish is to declare a new type that is a pointer-to-a-pointer-to-a-pointer-to-a-pointer-to-a-Handle. A better way to write it would be either of the following:
Option 1:
typedef RedirectedHandle ****Handle;
Option 2:
namespace MyStuff
{
typedef Handle **** ::Handle;
}
An even better solution would be to not use that many levels of indirection (who needs 4 levels of indirection for a Handle?) and to use smart pointers.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
A little bit better for everybody... :thumb:
Ovidiu
|
|
|
|
|
void CMyButton::PreSubclassWindow()
{
UINT nBS;
nBS = GetButtonStyle(); // GetStyle & 0xFF == all bs_* OR operator ?
m_nTypeStyle = nBS & BS_TYPEMASK; // GetStyle & 0xFF & 0xF ==? == all bs_* OR operator ?
if (nBS & BS_CHECKBOX)
m_bIsCheckBox = TRUE;
if (m_nTypeStyle == BS_DEFPUSHBUTTON) // why not use m_nTypeStyle & BS_DEFPUSHBUTTON
{
m_bIsDefault = TRUE;
}
ASSERT(m_nTypeStyle != BS_OWNERDRAW);// why not use !(m_nTypeStyle & BS_OWNERDRAW)
ModifyStyle(BS_TYPEMASK, BS_OWNERDRAW, SWP_FRAMECHANGED);
CButton::PreSubclassWindow();
}
LRESULT CMyButton::OnSetStyle(WPARAM wParam, LPARAM lParam)
{
UINT nNewType = (UINT)(wParam & BS_TYPEMASK); // why not use GetButtonStyle() & BS_TYPEMASK -> wParam & 0xFF & 0xF?
if (nNewType == BS_PUSHBUTTON) // why not use nNewType & BS_PUSHBUTTON? (if SetButtonStyle(BS_OWNERDRAW | BS_PUSHBUTTON)
{
m_bIsDefault = FALSE;
}
return DefWindowProc(BM_SETSTYLE,
(wParam & ~BS_TYPEMASK) | BS_OWNERDRAW, lParam); // why in here remove BS_TYPEMASK style?
}
thanks.
|
|
|
|
|
|
Let me guess!
It's the last Code Inspection Report for your project. Right?
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
this is a class from codeproject, now its class name is CButtonST(version 3.5 is CMyButton).
I only want to know why did author write that otherwise then me?
|
|
|
|
|
hi! My name is JC im from Puerto Rico. Right now my C++ knowledge is a bit "limited"
and Im developing an application tthat will end up updating a txt file in an FTP. I found a class that got the perfecy functions i need made by otom and found here
( http://www.codeproject.com/internet/ftpclientclass.asp ). The functions I need are exactluy the same he puts as an example:
nsFTP::CFTPClient ftpClient;
nsFTP::CLogonInfo logonInfo("localhost", 21, "anonymous",
"anonymous@user.com");
// connect to server
ftpClient.Login(logonInfo);
// do file operations
ftpClient.DownloadFile("/pub/test.txt", "c:\\temp\\test.txt");
ftpClient.UploadFile("c:\\temp\\test.txt", "/upload/test.txt");
// disconnect
ftpClient.Logout();
dat is basically all i need BUT his work is very hard to understand for me and i just dont know WHAT to include and where to include.. Id appreciate any help you guys can give me. Thanks in advance
-JC
|
|
|
|
|
I think he/she still maintains that article page. Why don't you post a message there. I am sure he/she will be happy to assist you.
Best,
Jun
|
|
|
|
|
Hi..
I have a charecter file in my hard drive...i want to read the file charecter by charecter and i wat to write those charecters to a stucture irrespective of their member variables...
birajendu
CyberG India
Delhi
India
|
|
|
|
|
You can still use the fread function and pass the address of your structure. But you have to take care of that because pading bytes are added between the members of your structure (so it is quite dangerous to handle that this way).
BTW, why do you want to do such a thing ?
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
is there any similar procedure as packed structure
birajendu
CyberG India
Delhi
India
|
|
|
|
|
birajendu wrote: is there any similar procedure as packed structure
Uh ? Could you be more explicit ?
Cédric Moonen
Software developer
Charting control
|
|
|
|