Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Issues with setting variables to true or false: how does the compiler understands it Date: Mon, 26 Oct 2015 17:09:13 -0700 Organization: None to speak of Lines: 39 Message-ID: References: <75tp2bt23h0o4e81r8j4pvf0aqpafc5kis@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="17533"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18YcscYg3BgdQ3Sek3wsSIF" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:j1neu0hyoJXJy4cn8FN6ErVi8kM= sha1:oHAud2zQLmzXMm5AoUtJfKW3a88= Xref: csiph.com comp.lang.c:73922 glen herrmannsfeldt writes: > Keith Thompson wrote: >> Richard Heathfield writes: > (snip) > >>> Write a program that displays only the first n lines of its input. > >>> Write a program that displays only the /last/ n lines of its input. >>> (Harder.) > > (snip) > >> A number of these programs provide opportunities to think about corner >> cases. For example, if a program is asked to display the first or last >> 10 lines of its input, what should it do if there are only 5 lines? >> What if there are *no* lines? > >> In such cases, I suggest that part of the exercise should be to define >> the behavior unambiguously. Sometime the answer may seem obvious but >> it's still worth writing down. > > In general, these are good ideas. > > I have seen problems that specifically exclude some corner cases. > > Consider an exam problem where the student time is limited. > So as not to distract them from the actual question, certain cases > that might be useful to test are excluded. Right. As a first step, it's ok just to enumerate the corner cases and document the fact that they're not (yet) being handled. [...] -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"