Suggestions for gnuc extensions

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

 



Hi,
Would you agree that these would be good as gnuc extensions?
And if you have any suggestions as to where could I learn how to implement those or pay someone to implement them would be greatly appreciated.

1. Implicit return struct

  1.
​```

  *   struct example{
     *
int a,b;
  *
}
struct example  func( int c ){
     *   return {  .a=2, .b=3}; //This is the new stuff
  *
}
```

    This can already be achieved with the follow (so it would be like a shorthand)
  return  (typeof(func(0)) {.a=2, .b=3}

2. Implicit struct comparisson:
​```
struct example{
    int a, b;
  int* pC;
}
void func(){
   int z=1, y=1;
   struct example   ex1= {  .a=0, .b=1, .pC=&z};
   struct example   ex2= {  .a=0, .b=1, .pC=&y};
  bool notValid  = (ex1 == ex2 ) ;  // New stuff:  struct comparisson
    bool Valid= ( ex1.a == ex2.a &&
                         ex1.b == ex2.b &&
                         ex1.pC == ex2.pC ); // False due to .pc being a different pointer

  // Maybe even introduce a new operand which could compare the pointer's values
    bool JScringe= (ex1 === ex2); // This would compare both *ex1.pC and *ex2.pC

}
```

Regards.




[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