Click here to Skip to main content
14,830,313 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: zero-sized array in struct/union Pin
Richard MacCutchan7-Aug-19 1:27
mveRichard MacCutchan7-Aug-19 1:27 
GeneralGet rid of the [] Pin
Davie212406-Aug-19 10:19
MemberDavie212406-Aug-19 10:19 
AnswerRe: zero-sized array in struct/union Pin
CPallini5-Aug-19 22:32
mveCPallini5-Aug-19 22:32 
GeneralRe: zero-sized array in struct/union Pin
_Flaviu5-Aug-19 22:41
Member_Flaviu5-Aug-19 22:41 
SuggestionRe: zero-sized array in struct/union Pin
Richard MacCutchan5-Aug-19 22:44
mveRichard MacCutchan5-Aug-19 22:44 
GeneralRe: zero-sized array in struct/union Pin
Stefan_Lang6-Aug-19 21:58
mveStefan_Lang6-Aug-19 21:58 
GeneralRe: zero-sized array in struct/union Pin
_Flaviu5-Aug-19 22:53
Member_Flaviu5-Aug-19 22:53 
Questionerror C2143 error C2059 Pin
_Flaviu31-Jul-19 1:03
Member_Flaviu31-Jul-19 1:03 
I am trying to integrate some old C code in a C++/MFC project and I met a strange error:
error C2143: syntax error : missing ')' before '{'
error C2059: syntax error : ')'
error C2143: syntax error : missing ')' before '{'
error C2143: syntax error : missing ')' before '{'
error C2143: syntax error : missing ';' before '{'
error C2059: syntax error : '{'
error C2059: syntax error : ')'
error C2059: syntax error : ')'
error C2059: syntax error : '=='
error C2059: syntax error : ')'

Here is the code:
static int some_function(const geometry_t* geometry)
{
	if (struct_cmp(geometry->part_type, GEOM_TYPE_X) == 0)    // <-- error
		return 1;

	return 0;                                                // <-- error
}                                                                // <-- error

Here is how is defined GEOM_TYPE_X:
#define GEOM_TYPE_X		\
	((const air_t){0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0}})

and air_t is:
typedef struct air_s air_t;
struct air_s
{
    unsigned int val1;
    unsigned short val2;
    unsigned short val3;
    unsigned char  val4;
    unsigned char  val5;
    unsigned char  node[6];
};

geometry->part_type is the same air_t type ... and struct_cmp is:
static inline int struct_cmp(const air_t left, const air_t right)
{
	return memcmp(&left, &right, sizeof(air_t));
}


Why I get this errors ? Where I should modify the code to make it run ? I have tried to modify GEOM_TYPE_X in several ways, no one has worked ...

Can you give me a little hint to get rid of this errors ?

P.S. Do you have enough information to see the problem ? If not, tell me to give you more details ...

modified 31-Jul-19 7:23am.

QuestionRe: error C2143 error C2059 Pin
Richard MacCutchan31-Jul-19 2:01
mveRichard MacCutchan31-Jul-19 2:01 
AnswerRe: error C2143 error C2059 Pin
_Flaviu31-Jul-19 2:38
Member_Flaviu31-Jul-19 2:38 
GeneralRe: error C2143 error C2059 Pin
Richard MacCutchan31-Jul-19 2:54
mveRichard MacCutchan31-Jul-19 2:54 
GeneralRe: error C2143 error C2059 Pin
_Flaviu31-Jul-19 3:27
Member_Flaviu31-Jul-19 3:27 
GeneralRe: error C2143 error C2059 Pin
Richard MacCutchan31-Jul-19 4:03
mveRichard MacCutchan31-Jul-19 4:03 
GeneralRe: error C2143 error C2059 Pin
_Flaviu31-Jul-19 22:01
Member_Flaviu31-Jul-19 22:01 
GeneralRe: error C2143 error C2059 Pin
k505431-Jul-19 5:39
mvek505431-Jul-19 5:39 
GeneralRe: error C2143 error C2059 Pin
_Flaviu31-Jul-19 21:06
Member_Flaviu31-Jul-19 21:06 
QuestionRe: error C2143 error C2059 Pin
David Crow1-Aug-19 3:22
MemberDavid Crow1-Aug-19 3:22 
AnswerRe: error C2143 error C2059 Pin
k50541-Aug-19 4:28
mvek50541-Aug-19 4:28 
GeneralRe: error C2143 error C2059 Pin
k50541-Aug-19 3:57
mvek50541-Aug-19 3:57 
GeneralRe: error C2143 error C2059 Pin
Richard MacCutchan31-Jul-19 21:32
mveRichard MacCutchan31-Jul-19 21:32 
GeneralRe: error C2143 error C2059 Pin
Peter_in_27801-Aug-19 0:53
professionalPeter_in_27801-Aug-19 0:53 
GeneralRe: error C2143 error C2059 Pin
Richard MacCutchan1-Aug-19 1:31
mveRichard MacCutchan1-Aug-19 1:31 
QuestionBest way to call REST Service from C++ Pin
ptr_Electron24-Jul-19 22:50
Memberptr_Electron24-Jul-19 22:50 
AnswerRe: Best way to call REST Service from C++ Pin
Gerry Schmitz25-Jul-19 2:49
mveGerry Schmitz25-Jul-19 2:49 
QuestionRe: Best way to call REST Service from C++ Pin
Richard MacCutchan25-Jul-19 3:52
mveRichard MacCutchan25-Jul-19 3:52 

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.