Re: Smart Pointers: Is there something similar to smart pointers in C?
- From: Richard Heathfield <invalid@xxxxxxxxxxxxxxx>
- Date: Tue, 12 Sep 2006 08:45:31 +0000
Rod Pemberton said:
"Bill Pursell" <bill.pursell@xxxxxxxxx> wrote in message
news:1158043184.686635.149140@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
If you are programming at a level where
you want a garbage collector, then you shouldn't be
programming in C. (My opinion.) The thing that takes
the place of a "smart pointer" in C is a "smart programmer".
You keep track of these things yourself.
Everyone here says that. I like that ideology and want to agree with
that.
Feel free.
But, apparently, it is a falsehood. If programmers were responsible, no
one here would be complaining about fgets and sprintf buffer overflows,
Wrong. The responsible programmers are the ones who know about these issues
(not that fgets is particularly vulnerable to buffer overflows as long as
you tell it the truth), and they can frequently be heard warning other
people about those issues, but they don't /complain/ about them. They write
their code defensively.
needing restrict pointers,
I've never seen a good justification for such a need.
free not setting the pointer to NULL,
It would be nice, but it's no big deal.
ptrdiff_t's insufficient range,
Since I hardly ever use it, why should I care?
undefined behavior for out-of-bounds pointers,
The solution to that is easy. Keep your pointers under control.
or any
other limitation, bug, or idiosyncratic feature of the C language.
Oh, come on - asking C programmers not to complain about C would be like
asking Formula 1 drivers not to complain about Formula 1 cars.
There'd
be no need for snprintf, strlcat, or garbage collection.
I have not yet seen a convincing argument that any of these is needed.
Certainly I've never needed them.
<snip>
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
.
- Follow-Ups:
- Re: Smart Pointers: Is there something similar to smart pointers in C?
- From: jacob navia
- Re: Smart Pointers: Is there something similar to smart pointers in C?
- References:
- Smart Pointers: Is there something similar to smart pointers in C?
- From: MotoK
- Re: Smart Pointers: Is there something similar to smart pointers in C?
- From: jacob navia
- Re: Smart Pointers: Is there something similar to smart pointers in C?
- From: Bill Pursell
- Re: Smart Pointers: Is there something similar to smart pointers in C?
- From: Rod Pemberton
- Smart Pointers: Is there something similar to smart pointers in C?
- Prev by Date: Thank You -- Thomas J. Gritzan
- Next by Date: Can't get automatic ftp working within system() method.
- Previous by thread: Re: Smart Pointers: Is there something similar to smart pointers in C?
- Next by thread: Re: Smart Pointers: Is there something similar to smart pointers in C?
- Index(es):
Relevant Pages
|