Yes, that's not a bad start - but I believe that are dozens other functions that should be used - instead of other functions. For example, I remember that a while back atoi and itoa were said to be unsafe and that there is a better "asteriskian" way of using those.
For example, the Wiki says: 2.15. String conversions When converting from strings to integers or floats, use the sscanf function in preference to the atoi and atof family of functions, as sscanf detects errors. Always check the return value of sscanf to verify that your numeric variables successfully scanned before using them. Also, to avoid a potential libc bug, always specify a maximum width for each conversion specifier, including integers and floats. A good length for both integers and floats is 30, as this is more than generous, even if you're using doubles or long integers. However, without a proper "best practice" example in the Wiki, people will do as they see fit, which in turn will turn into a "review board" ping-pong, which can be avoided by a simple sample in there. On Mon, Oct 30, 2017 at 9:22 PM Kevin Harwell <kharw...@digium.com> wrote: > On Mon, Oct 30, 2017 at 1:19 PM, Nir Simionovich < > nir.simionov...@gmail.com> wrote: > >> Definite +1 on the Documentation side - for sure. Here is a stupid >> question, is there a "Best Practices" coding document somewhere? >> I remember that many years ago there was something really basic, but much >> has changed since then. >> > > Are you referring to the coding guidelines? If so those can be found on > the wiki[1]. > > [1] https://wiki.asterisk.org/wiki/display/AST/Coding+Guidelines > > -- > > Kevin Harwell > Digium, Inc. | Software Developer > 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA > Check us out at: http://digium.com & http://asterisk.org > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > asterisk-dev mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-dev -- Kind Regards, Nir Simionovich GreenfieldTech (schedule) http://nirsimionovich.appointy.com/ (w) http://www.greenfieldtech.net (p) +972-73-2557799 (MSN): n...@greenfieldtech.net (m) +972-54-6982826 (GTALK): nir.simionov...@gmail.com (f) +972-73-2557202 (SKYPE): greenfieldtech.nir ---------------------------------------------------------- Zero Your Inbox <https://mailstrom.co/referral/ARZJE> | Cloud Servers <https://www.digitalocean.com/?refcode=97eeea09917a> ---------------------------------------------------------- *Disclaimer:* This e-mail is intended solely for the person to whom it is addressed and may contain confidential or legally privileged information. Access to this e-mail by anyone else is unauthorized. If an addressing or transmission error has misdirected this e-mail, please notify the author by replying to this e-mail and destroy this e-mail and any attachments. E-mail may be susceptible to data corruption, interception, unauthorized amendment, viruses and delays or the consequences thereof. If you are not the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing or copying of this email is strictly prohibited.
-- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev