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

Steve Underwood steveu at coppice.org
Sat Feb 4 19:33:20 MST 2006


Luigi Rizzo wrote:

>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.
>  
>
If in 2006 a C99 construct is not considered acceptable, that says a lot 
more about the crappy state of many people's compilers than about this 
code. For a long time I tried to make my own stuff work with old 
compilers. Now I've given up. I write for C99. If you can't compile it, 
get rid of the Mickey Mouse tools you are using.

Regards,
Steve




More information about the asterisk-dev mailing list