James Turner wrote:
> How do you generate a degree symbol under Linux? I was trying to and
> failed miserably ...

This is character 0xb0 in the various ISO 8859 character sets (try
"man ascii" and "man iso_8859_1"), which essentially replace ASCII on
modern systems.  US keyboards won't generate them, obviously, so
inserting them is going to be editor-dependent.  I used the GNOME
character picker, which was designed for this purpose -- just select
what you want, and cut/paste the text into your email editor.

> > char buf[64];
> > int i, len, top=0;
> > double stk[32], sign=1;
>
> 32 seems a trifle excessive, I might go with 4 ... not a big deal
> though.

Eeep, no!  Bad bug!  This is classic (read: "irresponsible") C,
remember?  The 32 is there for a reason -- the maximum number of
individual, whitespace-separted numbers to be pushed onto that stack
is equal to half of the input buffer length.  If you use anything less
than 32, your parser (remember what a parser does: accept input from
outside the program!) will be fragile and subject to stack overflow
with bad input.  Not a problem for your code, but goodness forbid that
someone writing an internet server (say, a big internet flight plan
database?) pasted the [4] in without realizing the danger.

And in any case, you're over-optimizing.  The performance difference
between placing a 32 element array on the stack and a 4 element array
on the stack is exactly zero.

> Would prefer to use strtod here, atof is deprecated. not sure about
> platform compatibility though.

If you like.  I've never heard of a libc implementation that lacks
atof, though.

Andy

-- 
Andrew J. Ross                NextBus Information Systems
Senior Software Engineer      Emeryville, CA
[EMAIL PROTECTED]              http://www.nextbus.com
"Men go crazy in conflagrations.  They only get better one by one."
 - Sting (misquoted)


_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to