Issue 71779
Summary Consider IF-ELSE update
Labels new issue
Assignees
Reporter SergMariaDB
    IF-ELSE => IF-OR-ELSE

Here is the idea for modification of IF-ELSE control statement with OR keyword addition.
Sample issue code:
 ```
if (a == 1 || a == 2) {
  if (a == 1) {
    // 'a' is 1
  }
  // 'a' is 1 or 2
} else {
  // 'a' is not 1 or 2
}
```
This requires repeating one of the conditions (or caching the condition in a variable and checking that variable in two places).  
so...

```c
switch (a)
{
    case 1:
 // specific operator
    case 2:
      // fallthrough from 1 or a == 2
      break;

    default:
      // something else
}
```
For non-constants may be put this way:
Solution:
```
IF (a==1) {
  Specific operator 
} OR (a==2) {
   Fallback from a==1 and for a==2 operator 
} else {
 a!=1, a!=2 operator 
}
```

See for more info: https://www.quora.com/profile/Serg-Kryvonos/Here-is-the-idea-for-modification-of-IF-ELSE-control-statement-with-OR-keyword-addition-Sample-issue-code-if-a
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to