[asterisk-dev] include/asterisk/sha1.h and sha1.c

Luigi Rizzo rizzo at icir.org
Sat Feb 4 11:10:48 MST 2006


On Sat, Feb 04, 2006 at 07:51:53PM +0800, Steve Underwood wrote:
...
> Whilst the ^Ms are a pain, why is the use of standardised data types 
> like int_least16_t considered bad?

because it is unnecessary  - a plain int would do the job perfectly.

A plain uint would be even better here, because the field is used
as an index into a 64-entry array, so you want an unsigned int type,
not an int.  And 7 bits suffice, not 16. So uint8_t would be
ok for the type, or basically any unsigned type.

Using a feature from the most recent standard when there is
a perfectly valid (actually better in this case, see above)
alternative in the previous standards is just a poor design
decision - it only makes the code less portable.

cheers
luigi



More information about the asterisk-dev mailing list