Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Could I get an explanation?

Status
Not open for further replies.

Zyrenthian

Programmer
Mar 30, 2001
1,440
US
I am just curious why when I :

typedef struct _SMemberVariableLookupTable{
char* path;
void* ptr;
int size;

}SMemberVariableLookupTable;

i can declare:

int x = 7;
SMemberVariableLookupTable[] = {
{ "Hello",
&x,
sizeof(x)
},
{
"goodbye",
&x,
sizeof(x)
}
};

BUT if i put a constructor in

typedef struct _SMemberVariableLookupTable{
char* path;
void* ptr;
int size;

_SMemberVariableLookupTable()
{memset(this,0,sizeof(this));}

// or this constructor

_SMemberVariableLookupTable():ptr(0),size(0){}

}SMemberVariableLookupTable;


It will no longer compile. If anyone could offer some insight it would be great.

Thanx
Matt

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top