diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-08-10 21:40:36 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-08-10 21:40:36 +0000 |
commit | d73eb218f9ddb1f68b1244483eb16db3e15427f1 (patch) | |
tree | 4ff1338edeb4032d96ca860821074ea717d31801 /doc | |
parent | 190edd24e377bc80baef2872d604ec76493b4d6b (diff) |
1.6.1.4 changes
git-svn-id: http://svn.digium.com/svn/asterisk/tags/1.6.1.4@211674 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'doc')
-rw-r--r-- | doc/CODING-GUIDELINES | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/doc/CODING-GUIDELINES b/doc/CODING-GUIDELINES index ed320368b..26e78529f 100644 --- a/doc/CODING-GUIDELINES +++ b/doc/CODING-GUIDELINES @@ -379,6 +379,18 @@ you wish to put into it (even if you did not allocate the buffer yourself), use a direct strcpy(), as it can be inlined and optimized to simple processor operations, unlike ast_copy_string(). +* 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. + * Use of functions ------------------ |