From: Jesse Ruffin <jesse@ajp-services.net>
To: linux-c-programming@vger.kernel.org
Subject: Re: Help: need to prevent infinite loop
Date: Sun, 22 Jan 2006 06:28:45 -0500 [thread overview]
Message-ID: <43D36C6D.4080500@ajp-services.net> (raw)
In-Reply-To: <17363.23676.751524.480464@cerise.gclements.plus.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I had hoped to convey that the standard library uses an ungetc() like
operation on the data it acquires, hence the quotes. This does not
consume anything from the user's point of view, and my GNU libc (2.3.5)
does use ungetc() for [f]scanf in a macro form.
I'll have to go read the standard to make sure, but I don't see anywhere
that scanf has to put anything back after it gets it. My manual says
this to say generally:
| If processing of a directive fails, no further input is read, and
| scanf() returns. A "failure" can be either of the following: input
| failure, meaning that input characters were unavailable, or matching
| failure, meaning that the input was inappropriate (see below).
This says (to me at least) that input is read, then matched. if there is
no match it returns. I am curious if this non consumptive behavior is
specified in the standard. I would prefer a non consumptive version
myself as I assume that operations on a stream affect the state of the
stream, whether or not they succeed. You can always use the return code
to seek yourself back if necessary. Consumption also makes more sense
when applied to non seeking streams as the junk input (like in the code
under discussion) will get thrown out.
Jesse Ruffin
AJP Services
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
iD8DBQFD02xs8GGeAXLl3osRApIiAJ9Y9P+41L0yIPmp+DCyIvFNn0vX7QCfXfQW
+pqE6A8zCvgcgWQHSQp3mWo=
=OGj+
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2006-01-22 11:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-17 4:36 Help: need to prevent infinite loop Shriramana Sharma
2006-01-17 7:14 ` Jesse Ruffin
2006-01-18 16:24 ` Shriramana Sharma
2006-01-18 16:33 ` Steve Graegert
2006-01-22 10:20 ` Glynn Clements
2006-01-22 11:28 ` Jesse Ruffin [this message]
2006-01-23 5:57 ` Jesse Ruffin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43D36C6D.4080500@ajp-services.net \
--to=jesse@ajp-services.net \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).