Re: another day, another patch ...
- From: Arne Vajhøj <arne@xxxxxxxxxx>
- Date: Tue, 10 Apr 2007 21:28:38 -0400
JF Mezei wrote:
re: bounds checking.
In a static array definition, I would define an array of say 100 items which would be the maximum I would ever expect to get.
So a "fancy" compiler would check array bounds within the first 100 items.
However, if my program has only loaded 27 items into the array, the compiler won't know this and will not prevent my program from accessing item 28.
So I still need logic in my program to ensure I don't access uninitialised areas or an array.
That is a C concept as well.
Many other languages would have that initialized.
And in a dynamically allocated array that may grow dynamically (realloc), you also need to have code to detect when your array is full so that you can add another chunk of memory to progressively grow it. (consider receiving an HTML page whose size is unknown, it should be short, or it could be very very long).
C makes this easy. COBOL isn't very good for that.
C is lousy at compared with languages that has a string type.
- Prev by Date: Re: another day, another patch ...
- Next by Date: Re: Global warming update: It's the sun stupid ...
- Previous by thread: Re: another day, another patch ...
- Next by thread: Re: another day, another patch ...