Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Stopping a while loop with user input ?

Reply
Thread Tools

Stopping a while loop with user input ?

 
 
Mabden
Guest
Posts: n/a
 
      10-27-2005
"Joe Wright" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Mabden wrote:
> > getch() might work.
> >

> Just when I thought you were learning.. getch() simply does not exist

in
> Standard C, the topic of this newsgroup. Various implementations may
> provide it (an others) as extensions but it isn't C.
>


Awww.. how sweet, you thought...

getch() is on page 78-79 of the only C standard that matters, K&R2.

I've never compiled a program using getch() and had it fail. But as I
said, I was surprized to find that I actually used SIGINT more than I
thought, and getch() less than you think.

So, while you are not wrong - you're wrong!

--
Mabden


 
Reply With Quote
 
 
 
 
Jordan Abel
Guest
Posts: n/a
 
      10-27-2005
On 2005-10-27, Mabden <mabden@sbc_global.net> wrote:
> "Joe Wright" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Mabden wrote:
>> > getch() might work.
>> >

>> Just when I thought you were learning.. getch() simply does not
>> exist in Standard C, the topic of this newsgroup. Various
>> implementations may provide it (an others) as extensions but it
>> isn't C.

>
> Awww.. how sweet, you thought...
>
> getch() is on page 78-79 of the only C standard that matters,
> K&R2.
>
> I've never compiled a program using getch() and had it fail. But
> as I said, I was surprized to find that I actually used SIGINT
> more than I thought, and getch() less than you think.
>
> So, while you are not wrong - you're wrong!


You are incorrect. K&R2 does NOT claim getch() exists or a standard
function. It uses the name in an example, which is in fact an
implicit claim that it is NOT a standard function
 
Reply With Quote
 
 
 
 
Flash Gordon
Guest
Posts: n/a
 
      10-27-2005
Mabden wrote:
> "Joe Wright" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
>>Mabden wrote:
>>
>>>getch() might work.

>>
>>Just when I thought you were learning.. getch() simply does not exist
>>in
>>Standard C, the topic of this newsgroup. Various implementations may
>>provide it (an others) as extensions but it isn't C.

>
> Awww.. how sweet, you thought...
>
> getch() is on page 78-79 of the only C standard that matters, K&R2.


Where it provides an implementation of getch which has different
semantics to the implementation I have on my Linux box and different
semantics to the implementation provided my MS in their C library. If
you look at Appendix B which describes the standard library you will
find absolutely NO reference to getch.

Also, it is the ISO standard that defines C and therefore what is
topical here, K&R2 is merely a very good, but not perfect, book about
the language.

> I've never compiled a program using getch() and had it fail.


Which proves nothing apart from your experience being limited.

> But as I
> said, I was surprized to find that I actually used SIGINT more than I
> thought, and getch() less than you think.
>
> So, while you are not wrong - you're wrong!


No, Joe is COMPLETELY correct and you are COMPLETELY wrong.

Since you are obviously not improving I'll put you back in the kill file.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
 
Reply With Quote
 
Mabden
Guest
Posts: n/a
 
      10-27-2005
"Flash Gordon" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)-gordon.me.uk...
> Since you are obviously not improving I'll put you back in the kill

file.
Hey! I just got to stretch my legs! Haven't you ever been wrong!!

--
Mabden



 
Reply With Quote
 
pete
Guest
Posts: n/a
 
      10-27-2005
Jordan Abel wrote:

> K&R2 does NOT claim getch() exists or a standard function.


You are correct.

> It uses the name in an example, which is in fact an
> implicit claim that it is NOT a standard function


You would think so, but there is a counterexample in K&R.

http://cm.bell-labs.com/cm/cs/cbook/2ediffs.html

119-121(5.11): The qsort discussion needs recasting in several ways.
First, qsort is a standard routine in ANSI/ISO C, so
the rendition here should be given a different name, especially because
the arguments to standard qsort are a bit different: the
standard accepts a base pointer and a count, while this example uses a
base pointer and two offsets.

--
pete
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      10-28-2005
pete <(E-Mail Removed)> writes:
> Jordan Abel wrote:
>
>> K&R2 does NOT claim getch() exists or a standard function.

>
> You are correct.
>
>> It uses the name in an example, which is in fact an
>> implicit claim that it is NOT a standard function

>
> You would think so, but there is a counterexample in K&R.
>
> http://cm.bell-labs.com/cm/cs/cbook/2ediffs.html
>
> 119-121(5.11): The qsort discussion needs recasting in several ways.
> First, qsort is a standard routine in ANSI/ISO C, so
> the rendition here should be given a different name, especially because
> the arguments to standard qsort are a bit different: the
> standard accepts a base pointer and a count, while this example uses a
> base pointer and two offsets.


But using the name "qsort" in an example *is* an implicit claim that
it's not a standard function. It happens to be an incorrect claim,
which is why it's mentioned in the errata.

--
Keith Thompson (The_Other_Keith) http://www.velocityreviews.com/forums/(E-Mail Removed) <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
Mabden
Guest
Posts: n/a
 
      10-28-2005
"Keith Thompson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> pete <(E-Mail Removed)> writes:
> > Jordan Abel wrote:
> >
> >> K&R2 does NOT claim getch() exists or a standard function.

> >
> > You are correct.
> >
> >> It uses the name in an example, which is in fact an
> >> implicit claim that it is NOT a standard function

> >
> > You would think so, but there is a counterexample in K&R.
> >
> > http://cm.bell-labs.com/cm/cs/cbook/2ediffs.html
> >
> > 119-121(5.11): The qsort discussion needs recasting in several

ways.
> > First, qsort is a standard routine in ANSI/ISO C, so
> > the rendition here should be given a different name, especially

because
> > the arguments to standard qsort are a bit different: the
> > standard accepts a base pointer and a count, while this example uses

a
> > base pointer and two offsets.

>
> But using the name "qsort" in an example *is* an implicit claim that
> it's not a standard function. It happens to be an incorrect claim,
> which is why it's mentioned in the errata.


So none of the programs named in K&R (2 in my version) are actually in
The Standard? Is that canonical? Have you checked this yourself, or is
it hearsay?

--
Mabden


 
Reply With Quote
 
Jordan Abel
Guest
Posts: n/a
 
      10-28-2005
On 2005-10-28, Mabden <mabden@sbc_global.net> wrote:
> "Keith Thompson" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> pete <(E-Mail Removed)> writes:
>> > Jordan Abel wrote:
>> >
>> >> K&R2 does NOT claim getch() exists or a standard function.
>> >
>> > You are correct.
>> >
>> >> It uses the name in an example, which is in fact an
>> >> implicit claim that it is NOT a standard function
>> >
>> > You would think so, but there is a counterexample in K&R.
>> >
>> > http://cm.bell-labs.com/cm/cs/cbook/2ediffs.html
>> >
>> > 119-121(5.11): The qsort discussion needs recasting in several

> ways.
>> > First, qsort is a standard routine in ANSI/ISO C, so
>> > the rendition here should be given a different name, especially

> because
>> > the arguments to standard qsort are a bit different: the
>> > standard accepts a base pointer and a count, while this example uses

> a
>> > base pointer and two offsets.

>>
>> But using the name "qsort" in an example *is* an implicit claim that
>> it's not a standard function. It happens to be an incorrect claim,
>> which is why it's mentioned in the errata.

>
> So none of the programs named in K&R (2 in my version) are actually in
> The Standard? Is that canonical? Have you checked this yourself, or is
> it hearsay?


No program which contains a definition of a standard function is
permitted on a conforming hosted implementation. With the sole (i
believe) exceptions of the qsort function and the unix-specific
examples in chapter 8, all the examples in K&R conform to the
standard.
 
Reply With Quote
 
Mark McIntyre
Guest
Posts: n/a
 
      10-28-2005
On Fri, 28 Oct 2005 10:43:44 +0000 (UTC), in comp.lang.c , Jordan Abel
<(E-Mail Removed)> wrote:

>No program which contains a definition of a standard function is
>permitted on a conforming hosted implementation.


I believe thats incorrect. My understanding is that the names are only
reserved if you include the header.

7.1.3 Reserved Identifiers
- Each identifier with file scope listed in any of the following
subclauses (including the future library directions) is reserved for
use as a macro name and as an identifier with file scope in the same
name space if any of its associated headers is included.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
 
Reply With Quote
 
Flash Gordon
Guest
Posts: n/a
 
      10-28-2005
Mark McIntyre wrote:
> On Fri, 28 Oct 2005 10:43:44 +0000 (UTC), in comp.lang.c , Jordan Abel
> <(E-Mail Removed)> wrote:
>
>>No program which contains a definition of a standard function is
>>permitted on a conforming hosted implementation.

>
> I believe thats incorrect. My understanding is that the names are only
> reserved if you include the header.
>
> 7.1.3 Reserved Identifiers
> - Each identifier with file scope listed in any of the following
> subclauses (including the future library directions) is reserved for
> use as a macro name and as an identifier with file scope in the same
> name space if any of its associated headers is included.


In n1124, section 7.13, it also says:
All identifiers with external linkage in any of the following
subclauses (including the future library directions) are always
reserved for use as identifiers with external linkage.157)

So you can never use the names for functions unless you don't include
the relevant header *and* you declare the function as static.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Triple nested loop python (While loop insde of for loop inside ofwhile loop) Isaac Won Python 9 03-04-2013 10:08 AM
while loop in a while loop Steven Java 5 03-30-2005 09:19 PM
Re: Stopping a loop with user input. in curses Raymond Arthur St. Marie II of III Python 1 07-23-2003 02:20 AM
Re: Stopping a loop with user input. in curses Raymond Arthur St. Marie II of III Python 2 07-22-2003 03:22 AM
Re: Stopping a loop with user input. in curses Chatralias Python 0 07-20-2003 03:09 PM



Advertisments