* Suggestions for gnuc extensions
@ 2024-03-12 22:50 l lerasi
0 siblings, 0 replies; only message in thread
From: l lerasi @ 2024-03-12 22:50 UTC (permalink / raw)
To: gcc-help
[-- Attachment #1: Type: text/plain, Size: 1203 bytes --]
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.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-03-12 22:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-12 22:50 Suggestions for gnuc extensions l lerasi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).