From: l lerasi <israel24961@hotmail.com>
To: "gcc-help@gcc.gnu.org" <gcc-help@gcc.gnu.org>
Subject: Suggestions for gnuc extensions
Date: Tue, 12 Mar 2024 22:50:11 +0000 [thread overview]
Message-ID: <AS8P251MB0231E73FC203B576EDAAADCCF72B2@AS8P251MB0231.EURP251.PROD.OUTLOOK.COM> (raw)
[-- 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.
reply other threads:[~2024-03-12 22:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AS8P251MB0231E73FC203B576EDAAADCCF72B2@AS8P251MB0231.EURP251.PROD.OUTLOOK.COM \
--to=israel24961@hotmail.com \
--cc=gcc-help@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).