ts-7000
[Top] [All Lists]

OT: Re: [ts-7000] Re: apis for lcd display and keypad

To:
Subject: OT: Re: [ts-7000] Re: apis for lcd display and keypad
From: "Mark Carlson" <>
Date: Wed, 5 Apr 2006 09:00:08 -0600
On 4/5/06, Don W. Carr <> wrote:
> And that brings up another point, you should never use sprintf(), use
> snprintf(), where the maximum length is given. Well, there are a
> number of the string functions that should not be used such as:

Arguably, you should never use snprintf() and only use sprintf().

After watching an afternoon-long IRC argument about this, I would like
to add the following points:
- Do not use snprintf() if you want it to be portable, not all
operating systems / libraries have implementations for this.
- You _can_ use sprintf() to act like snprintf :-) you just have to be
very religious in your formatting (which, for me, is far too
annoying.)
- If you are going to be using something non-standard anyway, why not
use asprintf() and avoid losing data?

I realize these do not apply in all situations, but until I heard them
I was a strong advocate of sn* functions as well.  I still use them
regularly, but no longer think they are a silver bullet.

-Mark


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU