473,699 Members | 2,417 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2924
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 "chunkinfop tr" here in your code.

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

and

typedef struct chunkinfoptr chunkinfoptr;
The 1st "chunkinfop tr" is an undefined struct.
The 2nd "chunkinfop tr" 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 "chunkinfop tr" is a type identifier.

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


The thred "chunkinfop tr" 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 "chunkinfop tr", 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
4946
by: Andrew Ward | last post by:
Hi All, Considering the following code: struct A; struct B { std::list<A> l; };
5
3727
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 dietz@dls.net
24
2095
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 first line, "warning C4132: 'x' : const object should be initialized" yet generates correct code.
7
1744
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 one ever use an incomplete type as an lvalue?
6
4199
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 22 of section 6.2.5. If so, that seems to make it difficult to allocate such structures, because sizeof() is not allowed on incomplete types (paragraph 1 of section 6.5.3.4). For instance, I've routinely done things like this: struct foo {...
2
6185
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 any sizeof use with incomplete type results in undefined behavior. Is 'b' so? If so, where in the standard does it say this? I only bring this up because of the following:
2
40864
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 type uint32_t ip; time_t time; };
2
2015
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 you can't use incomplete types to create objects of type T(that is incomplete), you can't use pointer arithmetic on T* types, you can't use new T..,..., you can't use sizeof... but you are allowed to have pointers and references to T... This is...
10
7627
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 array has incomplete element type" errors. I know that since 4.0 or so, GCC is less forgiving and does not accept any arrays of incomplete type (see http://gcc.gnu.org/ml/gcc/2005-02/msg00053.html). However, I cannot see where the array types are...
50
4482
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): //------------------------------------------------------------------ template<typename Data_t> class SmartPointer { Data_t* data; void(*deleterFunc)(Data_t*);
0
8685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8613
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9172
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9032
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7745
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6532
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4374
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.