Re: Linux printf funny



In comp.arch.embedded,
Paul Burke <paul@xxxxxxxxxx> wrote:
I'm converting an application from Windows console to Linux, and the
changeover has gone remarkably easily (considering that I know very
little about Linux), until now.

Is this a win32 console application or an old DOS application?

No problem installing GCC, KDevelop, FTDI USB drivers, remarkably few
changes to recompile the code... but printf fails after about
half-a-dozen calls. A float value prints as "nan"- not a number I asume,
rather than what I eat with an Indian takeout. This value is computed
from two int values (actually a weight and a tare reading) and
multiplied by a scale factor (1.0 for the tests).

The funny thing is that I can't see anything different about the weight
or the tare value between instances that print and those that fail.
There is the expected one-or-two bits wobble in the weight reading, but
the values only oscillate between plus and minus one relative to the
tare. Once it fails, it seems to be sticky- it doesn't recover even when
the readings are identical to before the nan.

So, please you Linux/ GCC experienced people- what absolutely basic item
of knowledge am I lacking?

It does not sound like a windows/linux problem, but more like a
programming error. So please show us the code.

I know I found some errors in old DOS (turbo C) test programs when I
ported them to new versions of compilers (windows or linux). These
programs worked normally using the old compiler but failed using a
newer one. All the errors where my own (beginners)fault: uninitialized
vars, wrong format specifiers, near/far pointer stuff etc.


--
Stef (remove caps, dashes and .invalid from e-mail address to reply by mail)

.



Relevant Pages

  • Linux printf funny
    ... I'm converting an application from Windows console to Linux, and the changeover has gone remarkably easily, until now. ... The funny thing is that I can't see anything different about the weight or the tare value between instances that print and those that fail. ... There is the expected one-or-two bits wobble in the weight reading, but the values only oscillate between plus and minus one relative to the tare. ...
    (comp.arch.embedded)
  • Re: Linux printf funny
    ... the changeover has gone remarkably easily (considering that I know ... very little about Linux), until now. ... reading) and multiplied by a scale factor. ... I can point out is that any operation on a NAN yields another NAN. ...
    (comp.arch.embedded)
  • Re: To the Brotherhood of the Consoles (Warning contains Wibble)
    ... >Linux challenges you. ... >documentation, waiting for compiles, sifting through newsgroups & ... Instead of reading documentation ...
    (comp.sys.sinclair)
  • Re: Why questions dont get answered, or "No, Ive already RTFM, tell me the answer!"
    ... >> My first experience with Linux was when I bought a book about Linux that ... >> contained Red Hat 5. ... > command line before starting a program before reading other ... > while you may need the reference for obscure options later. ...
    (Fedora)
  • Re: whats wrong with tar? -need advise!
    ... because they were written by a geek who is ... > reading, ... > computer illiterate people I've turned on to Linux), ... Linux geeks keep criticizing Windows and don't understand why everyone ...
    (linux.redhat)