473,401 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

has incomplete type

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
3 2893
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


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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Andrew Ward | last post by:
Hi All, Considering the following code: struct A; struct B { std::list<A> l; };
5
by: Paul F. Dietz | last post by:
Is the following legal C? struct foo; struct foo (*p); /* Pointer to array of 10 foo structures */ struct foo { int bar; int baz; }; main() { printf("%d\n", sizeof(*p)); } Paul Dietz...
24
by: ark | last post by:
Hello group, Could you help me with this: static const int x; ............ something ............. static const int x = 17; It looks perfectly legal to me but MSVC/C++ 6.0 gives, on the...
7
by: Mantorok Redgormor | last post by:
An lvalue is an expression with an object type or an incomplete type other than void;53) if an lvalue does not designate an object when it is evaluated, the behavior is undefined. When would...
6
by: Eric Smith | last post by:
Is a structure containing an incomplete array as its last element (per paragraph 2 of section 6.7.2.1 of ISO/IEC 9899:1999 (E)) itself an incomplete type? That appears to be indicated by paragraph...
2
by: aegis | last post by:
sizeof could not possibly evaluate to some size for a type, unless two things for a type occur: a) the type is complete and sizeof will evaluate to appropriate size b) type is not complete and...
2
by: Halid Umar A M | last post by:
Dear All, Please tell me why this error is occuring. The following is the code snippets which i have typed. struct mystructure{ struct list_head m; //error: field m has incomplete...
2
by: dave_dp | last post by:
Hi folks, I'm interested as to what extent using incomplete types doesn't result in a undefined behavior, more generally it touches the usage of incomplete types.. for example, it is stated that...
10
by: arcadio | last post by:
Hi everyone, I'm currently struggling to compile a large piece of legacy code. GCC 3.3 compiles it without complaining, but GCC 4.2.3 (the default in Debian) refuses it and signals "several...
50
by: Juha Nieminen | last post by:
I asked a long time ago in this group how to make a smart pointer which works with incomplete types. I got this answer (only relevant parts included): ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.