By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,282 Members | 1,548 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,282 IT Pros & Developers. It's quick & easy.

has incomplete type

P: n/a
Can anyone tell me the difference between
typedef struct chunkinfo* mfastbinptr;

and

typedef struct chunkinfoptr chunkinfoptr;
if you know that

struct chunkinfo{
struct chunkinfo* next;
struct chunkinfo* prev;
int size;
};

typedef struct chunkinfo* chunkinfoptr;

With the second i get a "has incomplete type" error
Nov 14 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
onsbomma wrote:
Can anyone tell me the difference between
typedef struct chunkinfo* mfastbinptr;

and

typedef struct chunkinfoptr chunkinfoptr;
if you know that

struct chunkinfo{
struct chunkinfo* next;
struct chunkinfo* prev;
int size;
};

typedef struct chunkinfo* chunkinfoptr; Note that the '*' means a pointer.

With the second i get a "has incomplete type" error


Let us do some simple substitutions:
The original problem line:
typedef struct chunkinfoptr chunkinfoptr;

Substitute "struct chunkinfo *" for chunkinfoptr:
typedef struct struct chunkinfoptr * chunkinfoptr;

Do you see the error?
Also, please don't use a structure tag as a type-id.
So, what are you trying to do?

Your code fragment above indicates some confusion
issues.

--
Thomas Matthews
Nov 14 '05 #2

P: n/a


onsbomma wrote:
Can anyone tell me the difference between
[...]


Please post the actual code and the actual error message.
Post a minimal but complete example that someone else could
process with a compiler. Trying to reconstruct what you were
actually doing is an error-prone process, likely to lead to
a diagnosis of a problem entirely different from the one you
are struggling with.

--
Er*********@sun.com

Nov 14 '05 #3

P: n/a
There are 3 "chunkinfoptr" here in your code.

onsbomma wrote:
Can anyone tell me the difference between
typedef struct chunkinfo* mfastbinptr;

and

typedef struct chunkinfoptr chunkinfoptr;
The 1st "chunkinfoptr" is an undefined struct.
The 2nd "chunkinfoptr" is an identifier of the undefined struct.

if you know that

struct chunkinfo{
struct chunkinfo* next;
struct chunkinfo* prev;
int size;
};

typedef struct chunkinfo* chunkinfoptr; The 3rd "chunkinfoptr" is a type identifier.

With the second i get a "has incomplete type" error


The thred "chunkinfoptr" are not conflict to each other in that they
are in different namespaces (typedef, struct and identifier).

But when you try to create a variable of the 2nd "chunkinfoptr", the
compiler will compalain "incomplete type", because "struct
chunkinfoptr" is undefined.

Nov 14 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.