Re: AW: Feature request for "friendship" of pointers in "C"

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

 



This is not the same!

1. usually the aObj is a Pointer:
   -> &aObj.obj => &(aObj->obj)
2. this DOUBLE indirect access creates definitely a CRASH if
   aObj is invalid or freed
3. I use a internal a Pointer typecheck… where I can detect if
   "my" pointer is valid or freed… but a "&(aObj->obj)" you
   don't survive.

mfg

On 03.02.20 08:37, Stefan Franke wrote:

....
The following solutions are acceptable:

1. "gcc" discover by its own that "base" is a "friend" of "A" and "B".
2. add a "frienddef" keyword like "typedef" using:
       typedef struct base * baseP;
       typedef struct A    * aP;
       typedef struct P    * bP;
       frienddef baseP aP;
       frienddef baseP bP;
3. add a #PRAGMA to enable/disable this feature 4. add a "gcc" api to easy
extend "GCC" without being FORCED
     to "hack" the core.

thanks for your help
Simply use

method_base(&aObj.obj, ...)
method_base(&bObj.obj, ...)

cheers

Stefan





[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