Re: Pointer to undeclared structure-type considered ok?

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

 



On 2005-02-02, Nick Patavalis <npat@xxxxxxxxxx> wrote:
>
> So in my original example, if I added something like "foo.b++", it
> would fail.  The error message is:
>
>   error: increment of pointer to unknown structure
>   error: arithmetic on pointer to an incomplete type
>
> Which indicates that "struct bar" is indeed a defined, but incomplete,
> data-type, and that it is ok to define pointers to incomplete
> data-types. Such pointers (i.e. pointer to incomplete data-types) have
> "special" semantics (similar but not identical to those of "void"
> pointers).

And the validation from the scriptures (ANSI/ISO 9899-1990):

  - *Section 6.1.2.5, pg.24, par.4*: A structure or a union of unknown
    content (as described in 6.5.2.3) is an incomplete type.

  - *Section 6.5.2.3, pg 62*: If a type-secifier of the form

      struct-or-union identifier

    occurs prior to the declaration that defines the content, the
    structure or union is an incomplete type.

  - *Section 6.1.2.5, pg.23, last list-item*: A pointer type may be
    derived from a function type, an object type or an incomplete
    type.

/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