This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: is it possible to size a pointer's target?


Tom St Denis skrev:
> The only way a function can know the length of an array pointed to by a
> pointer is by the caller passing that information to the function.
>
> Probably the best way if you want to clear up the clutter is to use a
> struct which has both a pointer and length (maybe stored as an int).
>   
Length as an int?!? Sounds weird. What are negative values supposed to
mean? It has to be an unsigned type, maybe size_t.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]