From Fedora Project Wiki
 
Line 2: Line 2:
  
 
- switch (x) { case 1..100: ; }
 
- switch (x) { case 1..100: ; }
 +
  - actually I think c11 may have something like this?
 
- conditionals statements as expressions
 
- conditionals statements as expressions
 
   if (control_flow(expr) stmt0;) stmt1;
 
   if (control_flow(expr) stmt0;) stmt1;

Latest revision as of 14:37, 30 October 2015

Things that could be done to make C better without really changing very much

- switch (x) { case 1..100: ; }

 - actually I think c11 may have something like this?

- conditionals statements as expressions

 if (control_flow(expr) stmt0;) stmt1;
 where the while(expr) stmt evaluates to 0 if stmt0 is never executed, or stmt0 the last time it is
 and:
 if (control_flow(expr) stmt0; else stmt1;) stmt2;
 which is essentially the same except stmt2 always happens after stmt1.

- #def ... #endef , so we don't have to use \ on macros

 - this gets us multi-line macros that still basically look like C and don't have to have \ all over the place, and get syntax highlit right
 - and error messages you can read from the compiler, by default.