**diff options**

author | Luc <enlightenment.org@lucb1e.com> | 2018-05-05 16:16:13 -0700 |
---|---|---|

committer | apache <apache@e5-web1.enlightenment.org> | 2018-05-05 16:16:13 -0700 |

commit | b2ef6743307960edf682414cdc249c0868fea712 (patch) | |

tree | a958489aed033848671f06d177a1f89d3b262f87 /pages/docs/c/start.txt | |

parent | 70146f5b760e7557b7fe33b99ff3a26a0146150c (diff) |

Wiki page start changed with summary [The bitwise "not" is a tilde, not an exclamation mark. Mentioned logical operators separately to hopefully make it more accurate and clear.] by Luc

Diffstat (limited to '')

-rw-r--r-- | pages/docs/c/start.txt | 2 |

1 files changed, 1 insertions, 1 deletions

diff --git a/pages/docs/c/start.txt b/pages/docs/c/start.txt index d7ccc6ecc..77ca1846c 100644 --- a/pages/docs/c/start.txt +++ b/pages/docs/c/start.txt | |||

@@ -290,7 +290,7 @@ You can now replace all ''struct sandwich'' instances with ''Sandwich''. Take no | |||

290 | 290 | ||

291 | ==== Arithmetic ==== | 291 | ==== Arithmetic ==== |

292 | 292 | ||

293 | C supports all the usual mathematics you might want as well as boolean logic (binary logic operations). you can add (''+''), subtract (''-''), multiply (''*''), divide (''/''), modulo (''%''), and then to bit-wise bit logic with XOR (''^''), AND (''&''), OR (''|''), NOT (''!''). It is highly advised to group operations in braces like () to be clear on the order of operation you wanted. So ''%%x = a * b - c / d%%'' is unclear as to what you intended. It is wise to explicitly group like ''%%x = a * ((b - c) / d)%%''. The same goes for the bit-wise operations as well. | 293 | C supports all the usual mathematics you might want, as well as binary logic operations and boolean logic. You can add (''+''), subtract (''-''), multiply (''*''), divide (''/''), modulo (''%''), do bit-wise logic operations with XOR (''^''), AND (''&''), OR (''|''), NOT (''~''), or do boolean logic with operators such as AND (''&&''), OR (''||''), NOT (''!''). It is highly advised to group operations in braces like () to be clear on the order of operation you wanted. So ''%%x = a * b - c / d%%'' is unclear as to what you intended. It is wise to explicitly group like ''%%x = a * ((b - c) / d)%%''. The same goes for the bit-wise operations as well. |

294 | 294 | ||

295 | Note that this arithmetic starts falling apart if you try to add two structs (it doesn't work), as these are not normal integers or floating point values. You can add two pointers of the same type, but do not use ''void *'' for pointer arithmetic as it is unclear what the unit is. Normally a pointer has a unit size of its type size. Also bit-wise arithmetic isn't very useful on floating point values etc. | 295 | Note that this arithmetic starts falling apart if you try to add two structs (it doesn't work), as these are not normal integers or floating point values. You can add two pointers of the same type, but do not use ''void *'' for pointer arithmetic as it is unclear what the unit is. Normally a pointer has a unit size of its type size. Also bit-wise arithmetic isn't very useful on floating point values etc. |

296 | 296 | ||