inclusive-lower-bound, exclusive-upper-bound (was Re: Range Operation pre-PEP)

David LeBlanc whisper at oz.nospamnet
Tue May 22 15:14:49 EDT 2001

In article <Pine.LNX.4.33.0105170139330.912-100000 at C800000->, greg at says...
> On Mon, 14 May 2001, Andrew Maizels wrote:
> > David LeBlanc wrote:
> > ...
> > No; after all, you have to use pointers at some level.  And C's arrays
> > and strings (which are just arrays, which are just pointers) aren't bad
> > if you're programming at a low level.
> >
> > Start using it to write applications and it's Memory Violation time and
> > Buffer Overflow Exploit of the Month Club.
> Since you're designing your own language I'm going to get a little
> pedantic on you.
> Arrays and pointers are NOT the same in C. In fact a lot of the problems
> people have writing working C code are caused by confusing the two things.
> * Pointers are modifiable l-values, array names are not.
> * The address of an array is known at compile time, but the value of a
> pointer is not known until run time. The compiler does not need to
> generate indirection code for an array.
> * An array definition implicitly allocates memory for the array elements.
> A pointer definition/declaration does not allocate any memory.
> * A pointer can be null, invalid, or pointing at the wrong place. An array
> name cannot.
> C (by design) treats array names as a pointer to the first element of
> the array in some contexts for convenience, but that is syntatic sugar,
> not an equivalence.
> I've written a lot of C code over the last 20 years and I have never had
> memory management problems so severe that I faulted the language. I
> certainly prefer Python in a lot of circumstances--and I don't miss
> explicit memory management when I use Python--but I don't think C is
> deeply flawed because it makes me pay attention to how I allocate,
> reference, and deallocate memory.
> > Yes, it can (and has) been made to work.  But it's not much fun.
> That's an understatement. The installed base of working C code is vast,
> and C is among a handful of languages still in use thirty years after it
> was first implemented. As for fun, well, that's a matter of taste. I like
> C, and I like Python. They are complementary tools, both well-designed and
> expressive.
> Another common misstatement about C that you repeated is "C is too
> low-level." Considering that C has been ported to practically every

I'm completely mis-quoted in this post. NONE of the text ascribed to me 
was written by me!

Dave Leblanc

More information about the Python-list mailing list