Re: Stupid question about c structures
- From: Guenther Sohler <guenther.sohler@xxxxxxxxx>
- Date: Tue, 11 Sep 2007 07:40:20 +0200
It was a stupid error on my side.
Problem solved
In one case the definition was available, in the other it wasn't :)
On Mon, 10 Sep 2007 11:39:30 -0600, Joe Pfeiffer wrote:
Josef Moellers <josef.moellers@xxxxxxxxxxxxxxxxxxx> writes:
Guenther Sohler wrote:
I want to declare a variable of type sockaddr_in
If I declare it plain into a c function
struct sockaddr_in server;
it works, fine
But if i place it inside a structure
it always complains
error: field 'server' has incomplete type
#include <netinet/in.h>
> whats the trick ?
The "trick" is, that you can define something as being a "struct
sockaddr_in" without telling what it actually looks like. You can then
declare pointers to this structure and cast between pointers of a
different type (e.g. struct sockaddr) and this pointer, but you cannot
declare a variable of this type or access any of its members.
If his question includes the actual declaration he's trying to make,
it isn't a pointer...
.
- References:
- Stupid question about c structures
- From: Guenther Sohler
- Re: Stupid question about c structures
- From: Josef Moellers
- Re: Stupid question about c structures
- From: Joe Pfeiffer
- Stupid question about c structures
- Prev by Date: Re: writing drivers using C++
- Next by Date: Re: writing drivers using C++
- Previous by thread: Re: Stupid question about c structures
- Next by thread: Re: Stupid question about c structures
- Index(es):
Relevant Pages
|