Click here to Skip to main content
15,908,909 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: VS2008 entropy - cannot open project resource views RC1015 error Pin
Gerry Schmitz25-Aug-19 3:44
mveGerry Schmitz25-Aug-19 3:44 
GeneralRe: VS2008 entropy - cannot open project resource views RC1015 error Pin
charlieg25-Aug-19 14:57
charlieg25-Aug-19 14:57 
AnswerRe: VS2008 entropy - cannot open project resource views RC1015 error Pin
mo149225-Aug-19 11:34
mo149225-Aug-19 11:34 
GeneralRe: VS2008 entropy - cannot open project resource views RC1015 error Pin
charlieg25-Aug-19 15:03
charlieg25-Aug-19 15:03 
GeneralRe: VS2008 entropy - cannot open project resource views RC1015 error Pin
mo149225-Aug-19 20:11
mo149225-Aug-19 20:11 
Questionerror C2059 Pin
_Flaviu20-Aug-19 2:05
_Flaviu20-Aug-19 2:05 
AnswerRe: error C2059 Pin
CPallini20-Aug-19 3:08
mveCPallini20-Aug-19 3:08 
GeneralRe: error C2059 Pin
_Flaviu20-Aug-19 3:27
_Flaviu20-Aug-19 3:27 
GeneralRe: error C2059 Pin
Richard MacCutchan20-Aug-19 4:11
mveRichard MacCutchan20-Aug-19 4:11 
GeneralRe: error C2059 Pin
_Flaviu20-Aug-19 21:30
_Flaviu20-Aug-19 21:30 
GeneralRe: error C2059 Pin
Richard MacCutchan20-Aug-19 21:56
mveRichard MacCutchan20-Aug-19 21:56 
GeneralRe: error C2059 Pin
CPallini20-Aug-19 6:46
mveCPallini20-Aug-19 6:46 
GeneralRe: error C2059 Pin
_Flaviu20-Aug-19 21:42
_Flaviu20-Aug-19 21:42 
GeneralRe: error C2059 Pin
CPallini20-Aug-19 21:59
mveCPallini20-Aug-19 21:59 
QuestionRe: error C2059 Pin
David Crow20-Aug-19 3:09
David Crow20-Aug-19 3:09 
AnswerRe: error C2059 Pin
_Flaviu20-Aug-19 3:32
_Flaviu20-Aug-19 3:32 
QuestionRe: error C2059 Pin
David Crow20-Aug-19 3:35
David Crow20-Aug-19 3:35 
AnswerRe: error C2059 Pin
mo149220-Aug-19 9:01
mo149220-Aug-19 9:01 
This is a combination of all of the above responses.
I have compiled this in mfc and it works.

struct data {
int something;
};
struct container {
int something_before;
struct data data_item;
int something_after;
};
#define list_entry(ptr, type, member) \
((type *)((char *)(ptr)-(size_t)(&((type *)0)->member))) // <-- here is the error ...
struct data *data_ptr;
struct container *cont_ptr = list_entry(data_ptr, struct container, data_item);


// This is the code you say is not compiling.
#define list_next_entry(pos, member) list_entry(0, 0, 0)
// This error is caused by the above line because list_entry(0,0,0) '0' is not a valid data type.
const int nTest = list_next_entry(0, 0); // <-- error C2059: syntax error : ')'

// If you do this instead...
#define list_next_entry(pos, member) list_entry(data_ptr, struct container, data_item)
// You will get a new error you will have to resolve in some way.
// error C2440: 'initializing' : cannot convert from 'container *' to 'const int'
// 1> There is no context in which this conversion is possible
// The compiler can't convert a pointer to an int.
// Don't know what you are trying to do.
const int nTest = list_next_entry(0, 0);
GeneralRe: error C2059 Pin
_Flaviu20-Aug-19 22:04
_Flaviu20-Aug-19 22:04 
GeneralRe: error C2059 Pin
_Flaviu20-Aug-19 22:14
_Flaviu20-Aug-19 22:14 
GeneralRe: error C2059 Pin
Stefan_Lang20-Aug-19 22:31
Stefan_Lang20-Aug-19 22:31 
GeneralRe: error C2059 Pin
_Flaviu20-Aug-19 23:22
_Flaviu20-Aug-19 23:22 
GeneralRe: error C2059 Pin
_Flaviu20-Aug-19 23:28
_Flaviu20-Aug-19 23:28 
GeneralRe: error C2059 Pin
_Flaviu20-Aug-19 23:39
_Flaviu20-Aug-19 23:39 
GeneralRe: error C2059 Pin
Richard MacCutchan21-Aug-19 0:03
mveRichard MacCutchan21-Aug-19 0:03 

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.