* aotto:

> Hi, the following scenario has a "definition hole" in the "C" language
>
> code example:
>
> -------------------------
> struct base {
>    ...
> };
>
> struct A {
>    struct base obj;
>    ...
> } aObj;
>
> struct B {
>    struct base obj;
>    ...
> } bObj;
>
> void method_base (struct base * hdl, ...);
>
> method_base(&aObj, ...)
> method_base(&bObj, ...)
> ------------------------
>
> - a POINTER to "A" is also a valid POINTER to "base"
>
> - a POINTER to "B" is also a valid POINTER to "base"

This is close to one of the extensions enabled by -fplan9-extensions.
It accepts such code if you make the base member anonymous:

struct A {
  struct base;
  ...
} aObj;

struct B {
  struct base;
  ...
} bObj;

Reply via email to