I assumed read() never fails the way it is written. It takes input directly
through the standard input from the user.
when I ran the program, the only way to stop it (other than entering "." )
was to press Ctrl+C or Ctrl+Z. In both cases the program just terminates.
I don't know how to "fail" read() in this case. It keeps asking for more.


On Thu, Oct 29, 2009 at 1:15 PM, Steve Wampler <[email protected]> wrote:

> Jafar Al-Gharaibeh wrote:
>
>> "while word_length(read())"   is an infinite loop because  the procedure
>> word_length() always succeeded ( return at the end).
>>
>
> Actually, no.  Since the read() will fail at some point in the loop
> [unless the input is *really* long!], the expression as a whole will
> fail (without even calling word_length()) and the loop will terminate.
> The stop("Bye") is the big problem.
>
> There are also issues with the way the word-count loop is implemented,
> it fails to count accurately on all sorts of input!
>
> --
> Steve Wampler -- [email protected]
> The gods that smiled on your birth are now laughing out loud.
>



-- 
"Let there be no compulsion in religion: Truth stands out clear from error"
[The Holy Qur'an 2:256]

"Injustice anywhere is a threat to justice everywhere"    Dr. King
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Unicon-group mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to