This is the mail archive of the archer@sourceware.org mailing list for the Archer 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: [python][patch] Add options length parameter to value.string(...)


Thiago Jung Bauermann wrote:
So, in the case of an array with known size, if we want to fetch the
whole of it without paying attention to null characters inside it, we
should set length to its size.
I'm not adverse to this if this is what is the most sensible thing to do. I guess what is the sanest default?

I don't think it's clear what the default should be. In your examples
above, do we want string() to return "george", or "george\0mildred" + 35
bytes of garbage? Tough.


I elected in the default case just to revert to existing behaviour for C strings. Terminate them on the first null regardless of the physical bounds of the array. And to provide the length option to override null detection.

It is tough choice, and I wonder if we'll run into similar issues with strings with other languages down the line.

Regards

Phil



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