Re: C++ Bounds Checking




"James Giles" <jamesgiles@xxxxxxxxxxxxxxxx> wrote in message
news:UMRji.291634$p47.163187@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
glen herrmannsfeldt wrote:
...
Related to the question about why people are more worried about
program speed now than they were 30 or 40 years ago...

I haven't found that to be a universal feeling. More common is
a kind of "penny wise - pound foolish" attitude where they use
really costly coding styles but also worry about minutia. In
terms of code size and/or cpu cycles for a given job programs
are certainly bigger and slower than in years past.

...
As for gets(), I don't find fgets() that much harder to use,
but I might see using gets() for a quick run-once program, such
as to test a compiler feature or other quick test. Even then,
fgets() isn't that hard to use.

Yes alternatives are easy to use and not noticably slower (it's
I/O! how could any simple test be significant compared to an I/O
system call?). My point was that gets() is still in the C standard
and still taught in schools. What lesson can students be expected
to learn from that? Surely they'll conclude that it's a reasonable
coding style.
I'm not sure what you mean here. C's leading Limey, Richard Heathfield,
considers gets() harmful, c.f. _C Unleashed_, p. 263. If I were going to
get() something, I'd use Cbfalconer's ggets(), which he has at his site. I
think it's ironic that it took Heathfield to solve the memory problems
involved therewith, and that's just this last year!
--
Wade Ward


.



Relevant Pages

  • Re: C++ Bounds Checking
    ... really costly coding styles but also worry about minutia. ... Yes alternatives are easy to use and not noticably slower (it's ... how could any simple test be significant compared to an I/O ... no deficiencies and the other way is to make it so complicated ...
    (comp.lang.fortran)
  • Re: Checking if a file exists
    ... Richard Heathfield wrote: ... # How are you going to do I/O /without/ it, in a portable manner? ... I'm not part of your inbred clique. ...
    (comp.lang.c)