Re: Pointer to undeclared structure-type considered ok?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2005-02-02, Kevin P. Fleming <kpfleming@xxxxxxxxxxxxxxx> wrote:
> Nick Patavalis wrote:
>
>> In what sense is the "struct bar" type defined? Because if "struct
>> bar" is not defined, then how can "struct bar *" be defined? Is it ok
>> to to have pointer-type whose base type is not (or incompletely)
>> defined?
>
> This technique is used rather often to hide structure definitions from 
> consumers of that structure.
>

This is very neat indeed! I have not seen it used, but it is
absolutely beautiful!

>
> Simple, and works very well. All users of foo.h know that "struct foo" 
> exists, and can store/retrieve pointers to one, and have functions to 
> manipulate one. They just can't peek inside one.
>

Of define a "foo" structure :-( which removes something from the
beauty of the concept, but, well, you can't have it all, can you?

/npat


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux