ts-7000
[Top] [All Lists]

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

To:
Subject: Re: OT: Re: [ts-7000] Re: apis for lcd display and keypad
From: "Don W. Carr" <>
Date: Wed, 5 Apr 2006 11:07:06 -0500
For me, I do safety critical things, so I can not use dangerous
functions, even to be portable, and I insist on minimums, such as a
recent g++ compiler and libraries. Usually though, there is a maximum
length string that you can display though, in this case 24 characters,
because of the display, so, better to display what you can than have
intermittant/unstable behavior.

I once spent a long time tracking down an intermitant problem related
to the fact that strncpy does NOT guarantee termination. The
programmer thought he was being safe. Both strncpy and strncat are
sleeper functions that will cause problems sooner or later. I made my
own safe versions.

Don.


On 4/5/06, Mark Carlson <> wrote:
>  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
>
>
>  Visit your group "ts-7000" on the web.
>
>  To unsubscribe from this group, send an email to:
>  
>
>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>
>  ________________________________
>


--
Dr. Don W. Carr
J. G. Montenegro 2258
Guadalajara, Mexico
+52-333-630-0704
+52-333-836-4500 ext 2930


 
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