[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Anybody working on ISO/IEC 15435 (i18n.h)?
keld@xxxxxxxx (Keld J¢rn Simonsen) wrote on 01.02.00 in <20000201084455.C4773@xxxxxxxxxxxxxx>:
> WG20 is happy to receive any input you have on this document.
> I am the editor, and I am happy to take informal discussions
> with you, either on this email list or on the WG20 email list or privately.
>
> You can also get onto the WG20 email list (after arrangements)
> if you like.
What sort of arrangements would that be?
> > - in the C bindings, for output string parameters, sometimes a maxlen
> > parameter is added, but not always. Also, it is unclear by what rules some
> > parameters are int and some are size_t. Some sort of general rule should
> > be used. (The origin of this problem is that a string lacks a "maxsize"
> > field. Maybe that should be changed?)
I wonder if something along these lines would be acceptable instead of the
current definition:
typedef struct {
size_t length, maxlength;
wchar_t *data;
} string;
or
typedef struct {
size_t length, maxlength;
wchar_t data[]; // C9x style syntax (unless they changed it again)
} *string;
Main benefit: the maximum length is an explicit string property, making
buffer overruns very unlikely. (Also, extra size parameters for conveying
this maximum size are not necessary.)
The first version can be used to handle arbitrary wchar_t data anywhere in
memory, which would probably be good for interoperability (that is, it is
not necessary that the length info can be fitted in front of the data).
The second is nearer to the current definition. (I think using wchar_t
values for length is not useful if there are actually two such members,
making the first actual character be at index 2.)
I think I prefer the first, though.
MfG Kai
-
Linux-UTF8: i18n of Linux on all levels
Archive: http://mail.nl.linux.org/lists/