1*5971e316SmrgThis document describes some aspects of the coding style of isl, 2*5971e316Smrgwhich is similar to that of the linux kernel and git. 3*5971e316Smrg 4*5971e316SmrgThe general rule is to use the same style as that of the surrounding code. 5*5971e316Smrg 6*5971e316SmrgMore specific rules: 7*5971e316Smrg - every line should have at most 80 columns 8*5971e316Smrg - use tabs for indentation, where a tab counts for 8 characters 9*5971e316Smrg - use single spaces around binary operators such as '+', '-', '=', '!=' 10*5971e316Smrg - no space after unary operators such as '!' 11*5971e316Smrg - use a single space after a comma and a semicolon 12*5971e316Smrg (except at the end of a line) 13*5971e316Smrg - no space between function name and arguments 14*5971e316Smrg - use a single space after control keywords such as if, for and while 15*5971e316Smrg - use a single space between the type of a cast and the value 16*5971e316Smrg that is being cast 17*5971e316Smrg - no whitespace at the end of a line 18*5971e316Smrg - opening brace of a function is placed on a new line 19*5971e316Smrg - opening brace of other blocks stays on the same line 20*5971e316Smrg - the body of a control statement is placed on the next line(s) 21*5971e316Smrg - an else appears on the same line as the closing brace of 22*5971e316Smrg the then branch, if there is such a closing brace 23*5971e316Smrg - if either the then or the else branch of an if has braces, 24*5971e316Smrg then they both have braces 25*5971e316Smrg - no parentheses around argument of return keyword 26*5971e316Smrg - use only C style comments (/* ... */) 27*5971e316Smrg - no comments inside function bodies; 28*5971e316Smrg if some part of a function deserves additional comments, then 29*5971e316Smrg extract it out into a separate function first 30*5971e316Smrg - no #ifs inside function bodies 31*5971e316Smrg - variables are declared at the start of a block, before any 32*5971e316Smrg other statements 33*5971e316Smrg 34*5971e316SmrgThere are some exceptions to the general rule of using 35*5971e316Smrgthe same style as the surrounding code, most notably 36*5971e316Smrgwhen the surrounding code is very old. 37*5971e316SmrgIn particular, an "isl_space" used to be called "isl_dim" and 38*5971e316Smrgsome variables of this type are still called "dim" or some variant thereof. 39*5971e316SmrgNew variables of this type should be called "space" or a more specific name. 40*5971e316SmrgSome old functions do not have memory management annotations yet. 41*5971e316SmrgAll new functions should have memory management annotations, 42*5971e316Smrgwhenever appropriate 43