Click here to Skip to main content
15,899,754 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Problems when configuring Visual Studio ... Pin
SNArruda13-Aug-08 3:34
SNArruda13-Aug-08 3:34 
QuestionI am using a thread for which I am sending structure as parameter... :( ending up with error C2440: '=' Pin
ptr_Electron13-Aug-08 3:11
ptr_Electron13-Aug-08 3:11 
AnswerRe: I am using a thread for which I am sending structure as parameter... :( ending up with error C2440: '=' Pin
Cedric Moonen13-Aug-08 3:15
Cedric Moonen13-Aug-08 3:15 
AnswerRe: I am using a thread for which I am sending structure as parameter... :( ending up with error C2440: '=' Pin
Jijo.Raj13-Aug-08 3:17
Jijo.Raj13-Aug-08 3:17 
GeneralRe: I am using a thread for which I am sending structure as parameter... :( ending up with error C2440: '=' Pin
ptr_Electron13-Aug-08 3:20
ptr_Electron13-Aug-08 3:20 
GeneralRe: I am using a thread for which I am sending structure as parameter... :( ending up with error C2440: '=' Pin
Cedric Moonen13-Aug-08 3:42
Cedric Moonen13-Aug-08 3:42 
GeneralRe: I am using a thread for which I am sending structure as parameter... :( ending up with error C2440: '=' Pin
ptr_Electron13-Aug-08 3:59
ptr_Electron13-Aug-08 3:59 
GeneralRe: I am using a thread for which I am sending structure as parameter... :( ending up with error C2440: '=' Pin
Jijo.Raj13-Aug-08 3:46
Jijo.Raj13-Aug-08 3:46 
The basic problem is you are assigning a const pointer to a non-const pointer. Well, if you want to keep the consts in the function signature, then possible get arounds are

1) Make the Scope *_this; as const. The only problem is since its a const member, you've to initialize it by constructor. So your code snippet will change like this -

typedef struct THREADSTRUCT_SCOPE			
{
   // constructor.
   THREADSTRUCT_SCOPE( const Scope* ptr )
      : _this( ptr )
   {}

   const Scope *_this;
}THREADSTRUCT_SCOPE;


And allocate it like this,
bool Scope::searchABCByAttributes()
{
THREADSTRUCT_SCOPE *_param= new THREADSTRUCT_SCOPE( this );

...
}


1) You can also use cstyle casting or const_cast to remove the constness. But its not recommended. It can be done as follows. Just FYI.
_param->_this = (Scope*)this; // Error 


Regards,
Jijo.

_____________________________________________________

http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.

GeneralRe: I am using a thread for which I am sending structure as parameter... :( ending up with error C2440: '=' Pin
ptr_Electron13-Aug-08 4:12
ptr_Electron13-Aug-08 4:12 
GeneralRe: I am using a thread for which I am sending structure as parameter... :( ending up with error C2440: '=' Pin
Jijo.Raj13-Aug-08 5:42
Jijo.Raj13-Aug-08 5:42 
GeneralRe: I am using a thread for which I am sending structure as parameter... :( ending up with error C2440: '=' Pin
ptr_Electron13-Aug-08 6:00
ptr_Electron13-Aug-08 6:00 
GeneralRe: I am using a thread for which I am sending structure as parameter... :( ending up with error C2440: '=' Pin
Jijo.Raj13-Aug-08 6:39
Jijo.Raj13-Aug-08 6:39 
GeneralRe: I am using a thread for which I am sending structure as parameter... :( ending up with error C2440: '=' Pin
ptr_Electron13-Aug-08 18:32
ptr_Electron13-Aug-08 18:32 
GeneralRe: I am using a thread for which I am sending structure as parameter... :( ending up with error C2440: '=' Pin
Jijo.Raj13-Aug-08 18:57
Jijo.Raj13-Aug-08 18:57 
Questiondisplay a bmp image dynamically using win32 sdk c++ Pin
raesa13-Aug-08 2:41
raesa13-Aug-08 2:41 
AnswerRe: display a bmp image dynamically using win32 sdk c++ Pin
KarstenK13-Aug-08 3:58
mveKarstenK13-Aug-08 3:58 
GeneralRe: display a bmp image dynamically using win32 sdk c++ Pin
raesa13-Aug-08 17:45
raesa13-Aug-08 17:45 
AnswerRe: display a bmp image dynamically using win32 sdk c++ Pin
oobimoo13-Aug-08 5:56
oobimoo13-Aug-08 5:56 
GeneralRe: display a bmp image dynamically using win32 sdk c++ Pin
raesa13-Aug-08 17:47
raesa13-Aug-08 17:47 
QuestionC++ program that reads N numbers from the keyboard Pin
rameshkalavala13-Aug-08 2:38
rameshkalavala13-Aug-08 2:38 
AnswerRe: C++ program that reads N numbers from the keyboard Pin
_AnsHUMAN_ 13-Aug-08 2:40
_AnsHUMAN_ 13-Aug-08 2:40 
AnswerRe: C++ program that reads N numbers from the keyboard Pin
toxcct13-Aug-08 2:51
toxcct13-Aug-08 2:51 
AnswerRe: C++ program that reads N numbers from the keyboard Pin
Cedric Moonen13-Aug-08 2:54
Cedric Moonen13-Aug-08 2:54 
AnswerRe: C++ program that reads N numbers from the keyboard Pin
Michael Schubert13-Aug-08 2:55
Michael Schubert13-Aug-08 2:55 
Questionneed source code Pin
rameshkalavala13-Aug-08 2:33
rameshkalavala13-Aug-08 2:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.