-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Bassel Mabsout edited this page Jul 11, 2014
·
11 revisions
-
multiple assign:
cheese = false; chicken = false; things = false; -> cheese, chicken, things = false;
-
replace semicolon with newline:
chicken = false; cheese = true; -> chicken = false cheese = true
-
constructor overloading in < c++11
-
replace curly braces with indentation:
void yes() { test(); test2(); int cheese[] = { 1, 2, 3 } } -> void yes() test(); test2(); int cheese[] = 1 2 3
-
add |> pipeline operator:
chicken(cheese(test(array))); -> array |> test |> cheese |> chicken or array |> test |> cheese |> chicken
-
combine header and main file for better usability
-
conditional assignment:
int cheese; if(yes) cheese = 1; else cheese = 20; -> int cheese = if(yes) 1 else 2
-
better readable struct:
switch(x) { case 1: case 2: doSomething(); break; case 3: doSomethingElse() } -> switch(x) { case 1, 2: doSomething(); case 3: doSomethingElse(); }
-
allow elif instead of else if
-
allow space listing instead of commas:
bool *a, *b, *c, *d, *e; int test[] = {1, 2, 3, 4}; -> bool* a b c d e; int test[] = {1 2 3 4};
-
support for ranges:
for(int i = 0; i < 10; i++) switch(i) { case 1: case 2: case 3: case 4: doSomething(); } -> for(i in 0..10) switch(i) { case 1..4: doSomething(); }
-
optional parentheses in if statements:
if(true) doStuff(); -> if true doStuff();
-
change parentheses behavior:
doStuff(a, b, add1To(c), d); -> doStuff a, b, (add1TO c), d; -
change assignment and declaration behavior:
//decleration and assignment: int i = 0; //array: int array[] = {1, 2, 3, 4}; //arrays with the same values; int array[] = {1, 2, 3, 4}; int array2[] = {1, 2, 3, 4}; //same line: int b = 2; float b = 4; double c =5; //same types: int b = 5; int c = 2; int d = 6; int e = 7; //same line same type: int b = 5, c = 2, d = 6, e = 7; //same line same value: int b = 3, c = 3, d = 3, e = 3; //assignments: a = 5; b = 3; //same line assignments some same a = 5; b = 3; d = 3; c = 3; //same value many assignments a = 3; b = 3; -> //decleration and assignment: int|i 0 //array: int[]|array 1 2 3 4 //arrays with the same values: int[]|array array2 = 1 2 3 4 //same line: int{b 2}; float{b 4}; double{c 5} //same types: int|b 5 c 2 d 6 e 7 //same line same type: int{b 5} {c 2} {d 6} {e 7} //same line same value: int{a b c d = 5}; float{f g h i = 3} //same line some same value some not int|a {b 3} {c d = 4}; float{f g h = 3} {i 2} //not same type some same value some not int|a b 3 c d = 4 f g h = 3 //assignments: a = 5 b = 3 //same line assignments some same {a 5} {b 3} {d c = 4} //same value many assignments a b = 3
-
change function arguments behavior:
//function same line different types f(int a, float b) //function same line same type f(int a,int b, float c,float d ) //function same line default values f(int a = 2,int b = 4, float c = 3.5,float d = 3.4) //function same values same line f(int a = 1, int c = 3,int d = 3,int b= 2, float c = 3.4,float d = 3.4,float e ) //function some same different lines f( int a = 3, int b = 4, int c = 5, int d = 5, int e = 5, float f = 6, float g = 6, float h = 6 ) //function same line different types f( int a | float b ) //function same line same type f( int a b | float c d ) //function same line default values f( int{a 2} {b 4} | float{c 3.5} {d 3.4} ) //function same values same line f( int{a 1} {c d 3} {b 2} | float{c d 3.4} e ) //function some same different lines f( int|a = 3 b = 4 c d e = 5 float f g h = 6 )
-
make argument permutations easily doable:
f(int i, float j, bool k) //code f(int i, bool k, float j) //code f(bool k, int i, float j) //code f(bool k, float j, int i) //code f(float j, int i, bool k) //code f(float j, bool k, int i) //code -> f(int i || float j || bool k ) //code
-
declaration specifier scope
static int c = 5; static float d = 5; static const double a = 5; static const decimal b = 5; -> static int c = 5; float d = 5; const double a = 5; decimal b = 6;