B
Bill Cunningham
What does the following code mean?
struct GUID *guid ={0};
Is it similar to a C++ virtual function?
Bill
struct GUID *guid ={0};
Is it similar to a C++ virtual function?
Bill
Bill Cunningham said:What does the following code mean?
struct GUID *guid ={0};
Is it similar to a C++ virtual function?
What does the following code mean?
struct GUID *guid ={0};
Is it similar to a C++ virtual function?
Bill Cunningham said:What does the following code mean?
struct GUID *guid ={0};
Is it similar to a C++ virtual function?
Then C is an object language.Mark A. Odell said:No. It means, create a pointer to a struct GUID and initialize this new
pointer to 0. The {} are not necessary here. I'd write this as:
struct GUID *pGuid = NULL;
But if I actually wanted a GUID object, and not a pointer to one,
initialzed to zero I'd need to write:
struct GUID guid = { 0 };
or
struct GUID guid;
memset(guid, 0, sizeof guid);
A struct GUID then, how would one write it. The GUID comes from MS's COM.Joona I Palaste said:It initialises a pointer to struct GUID, whatever struct GUID is. The
pointer is currently not pointing at any struct GUID.
Bill Cunningham said:A struct GUID then, how would one write it. The GUID comes from MS's COM.
struct GUID (int x,int y);
The GUID struct is already defined in COM but that doesn't help me learn the
concept of struct. What I've seen looks like data type declarations and no
functions.
struct A{
int a;
char b;
double c;};
Joona I Palaste said:COM.
This is a syntax error in C. Would you be wanting comp.lang.c++?
Structs are different things in C and C++. Pick a language. If it's
really C then reply again and I will explain what structs are in C.
C of course. This is clc. What I was saying was that I never see functions
in structs. Just declared data types.
But if I actually wanted a GUID object, and not a pointer to one,
initialzed to zero I'd need to write:
struct GUID guid = { 0 };
Ok.
or
struct GUID guid;
memset(guid, 0, sizeof guid);
This isn't a very good idea.
Then C is an object language.
C of course. This is clc. What I was saying was that I never see
functions in structs. Just declared data types.
Mark said:Are you concerned about traps? I suppose this may not be fully portable
but I admit I am guilty of doing this quite often.
Bill said:Then C is an object language.
Joona I Palaste said:Did you read this bit?
If it's C then your compiler will choke on:
struct GUID (int x, int y);
I think he meant struct GUID {int x, int y};
Are you concerned about traps? I suppose this may not be fully portable
but I admit I am guilty of doing this quite often.
What's wrong with it?
Then C is an object language.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.