Re: Variable length arrays proposal
- From: Thad Smith <ThadSmith@xxxxxxx>
- Date: Thu, 30 Jun 2005 13:56:15 -0600
Randy Howard wrote:
On Wed, 29 Jun 2005 11:29:03 -0500, jacob navia wrote (in article <42c2cc50$0$1217$8fcfb975@xxxxxxxxxxxxxxx>):
Proposal:
Allow the following syntax:
typedef struct { int length; char data[length]; } String; This would indicate to the compiler that the "data" array will have the length indicated by the "length" member. This would allow to easily write code that automatically writes the structure to disk, and allow that the compiler generates code to check for index errors when accessing the "data" array.
Constraints:
The index should be a structure member of integer type.
Along with the other comments, even if it went through, the index should be size_t, not int.
I see no reason that length couldn't be any signed or unsigned integer type. We aren't constrained to only have index expressions of type size_t.
That said, I think the proposal goes beyond the spirit of C.
Thad
.
- Follow-Ups:
- Re: Variable length arrays proposal
- From: Douglas A. Gwyn
- Re: Variable length arrays proposal
- References:
- Variable length arrays proposal
- From: jacob navia
- Re: Variable length arrays proposal
- From: Randy Howard
- Variable length arrays proposal
- Prev by Date: Re: Variable length arrays proposal
- Next by Date: Re: Variable length arrays proposal
- Previous by thread: Re: Variable length arrays proposal
- Next by thread: Re: Variable length arrays proposal
- Index(es):
Relevant Pages
|