On Fri, Aug 8, 2025 at 5:54 PM uso ewin <uso.cosmo....@gmail.com> wrote:
> > > On Fri, Aug 8, 2025 at 4:18 PM grischka via Tinycc-devel < > tinycc-devel@nongnu.org> wrote: > >> On 08.08.2025 01:19, uso ewin wrote: >> > Hello, >> > >> > I've added support for C2Y n3356 to tinycc >> > The code is here: >> > >> https://github.com/cosmo-ray/tcc/commit/41e2b8e8875e681bf4ce11df15e9ac930c4b1580 >> > and the standard here: >> > https://www.open-std.org/JTC1/SC22/WG14/www/docs/n3356.htm >> > >> > Do you want me to push it to mob ? >> >> You did not say why you want tinycc to have this? >> >> For example, if someone today would write >> if (a_var + b_var * c_var > v_max || force) { >> if (a_var + b_var * c_var > v_max) >> v_max = a_var + b_var * c_var; >> print(v_max); >> } >> with no problems, how would you think would the availability >> of that c2y if clause proposal in tinycc have influence? >> >> -- gr >> >> > I do find > if (int i = something; i > MAX) {} > more readable than > int i; > if ((i = something) > MAX) {} > > Also, it can be useful so you have fewer variables in your function scope, > the same way c99 for loop do it. > Maybe it can be useful for some macros too, I mean C99 for, > are use for > FOREACH(obj, elem), // elem is declared in the for > I could see the same kind of code with c2y if: > TRY_GET(obj, "key", elem) {}. > Though as the feature is new, I didn't see a lot of experiment with this. > > I don't think this feature is a must-have, but It can make some condition > cleaner, > and I'd love to use it in my projects that use tinycc. > Then if you say that you prefer to keep tcc small, > or that you want the standard to be release before including this kind of > feature to tcc, > I understand. > > Thanks for answering. > > Matthias, > > > As it's been a long time since I've contributed to tinycc , I'm not sure >> if >> > I didn't make a mistake, so a review would be appreciated if the feature >> > seems OK :) >> > >> > Thanks, >> > Matthias >> >> Hey, My first code had a bug with an array declared in if. It should be fixed, here: https://github.com/cosmo-ray/tcc/commits/c2y-if-switch-decl/ The patch is pretty unlikely to bring a new bug to existing code, as, new code should be called only if we're in a declaration inside an if or a switch. I've also added more tests. Anyway, I'd like to know if there is something wrong with the patch, or if someone is against having this in Tinycc. If no one answer this, I'll push to mob in 1 week. (so the 17/08) Matthias _______________________________________________ >> Tinycc-devel mailing list >> Tinycc-devel@nongnu.org >> https://lists.nongnu.org/mailman/listinfo/tinycc-devel >> >
_______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel