Re: A function returning string or pointer
- From: richard@xxxxxxxxxxxxxxx (Richard Tobin)
- Date: 14 Nov 2006 17:38:12 GMT
In article <1163525240.860273.84030@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
santosh <santosh.k83@xxxxxxxxx> wrote:
do
{
ch = getc(fp);
}
while(ch != EOF && ch != '\n');
This may be okay for flushing input but if you want to process it, then
having the test for EOF and NL at the bottom is wasteful as the code
within the DO clause has to do the test anyway.
A reasonable compiler will optimise that if you could. Even if it
doesn't, clarity is usually much more important than that kind of
micro-optimisation.
-- RIchard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
.
- References:
- A function returning string or pointer
- From: svata
- Re: A function returning string or pointer
- From: CBFalconer
- Re: A function returning string or pointer
- From: Simon Biber
- Re: A function returning string or pointer
- From: santosh
- A function returning string or pointer
- Prev by Date: Re: Syntax for variable names spanning multiple lines in C
- Next by Date: Re: when to use C and when to use C++
- Previous by thread: Re: A function returning string or pointer
- Next by thread: Re: A function returning string or pointer
- Index(es):
Relevant Pages
|