Timeline for Binary Search in C - Optimization
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 23, 2016 at 10:47 | comment | added | Marcelo De Zen | Signaling the array as const is a good idea, for the other parameters const it's meaningless and just bloats the code. As for the the identifiers, I would argue that max_index is better than just max. A good rule of thumb (that do not work for every case) is to have a noun in the mix. | |
Jul 12, 2013 at 14:54 | vote | accept | Aseem Bansal | ||
Jul 11, 2013 at 14:07 | comment | added | Aseem Bansal |
Asked a question on programmers about use of the const keyword. Please give your comments and suggest improvements.
|
|
Jul 11, 2013 at 13:22 | history | edited | William Morris | CC BY-SA 3.0 |
Discussed the use of const in function parameters
|
Jul 9, 2013 at 19:57 | comment | added | William Morris | Yes, that is correct | |
Jul 9, 2013 at 17:55 | comment | added | Aseem Bansal |
So const should be used whenever I am passing pointers but not changing the contents. Correct?
|
|
Jul 9, 2013 at 17:37 | history | edited | William Morris | CC BY-SA 3.0 |
Updated comments to make reasons clear.
|
Jul 9, 2013 at 17:19 | comment | added | Aseem Bansal |
I'll take care of the incorrect comment. About arr being const why? I used min and max but max is defined in C++ and the IDE that I use(Code:blocks) starts to highlight it as a keyword so I thought to change them. It has auto-completion so length of variables isn't a problem. Any particular reason why I should use static functions? Can you tell me what it is this called so I can read up a bit(like static for variables is storage class )? About exit status, is that a convention or what?
|
|
Jul 9, 2013 at 17:04 | history | answered | William Morris | CC BY-SA 3.0 |