On 12/28/19 12:44 PM, ag wrote:
> is your opininion that this is adequate?
>
> typedef ptrdiff_t msize_t (m for memory here)
Yes, something like that. dfa.c calls this type 'idx_t', which is a couple of
characters shorter.
Hi Paul,
On Sat, Dec 28, at 10:28 Paul Eggert wrote:
> > Based on the above assumptions this can be extended. First instead of
> > size_t to
> > return ssize_t, so functions can return -1 and set errno accordingly.
>
> It's better to use ptrdiff_t for this sort of thing, since it's hardwired int
On 12/28/19 5:14 AM, ag wrote:
> - PTRDIFF_MAX is at least INT_MAX and at most SIZE_MAX
> (PTRDIFF_MAX is INT_MAX in 32bit)
PTRDIFF_MAX can exceed SIZE_MAX, in the sense that POSIX and C allows it and it
could be useful on 32-bit platforms for size_t to be 32 bits and ptrdiff_t to be
64 bit
On 12/28/19 3:17 AM, Bruno Haible wrote:
> Would you find it useful to have an immutable string type in gnulib?
Sounds useful. I assume you plan to generalize it to any type; something like
this:
p = immalloc (sizeof *p);
p->x = whatever; p->y = something; ...
imfreeze (p, sizeof *p);
[
On Sat, Dec 28, 2019 at 3:17 AM Bruno Haible wrote:
> Would you find it useful to have an immutable string type in gnulib?
I like this idea! Actually the idea of having primitives for allocating and
filling data and then getting read-only access to it is a good one in
general. I haven't worked w
Hi,
On Fri, Dec 27, at 11:51 Bruno Haible wrote:
> - providing primitives for string allocation reduces the amount of buffer
>overflow bugs that otherwise occur in this area. [1]
[1] Re: string allocation
https://lists.gnu.org/archive/html/bug-gnulib/2019-09/msg00031.html
Thanks, i remember
Hi Bruno,
On 28.12.19 12:17, Bruno Haible wrote:
> Would you find it useful to have an immutable string type in gnulib?
The idea is good in fact had similar thoughts/needs a while ago. IMO,
the use cases are mostly in the testing area (especially fuzzing).
As a more general approach, a function
Hi all,
Would you find it useful to have an immutable string type in gnulib?
In the simplest case, this would a 'const char *' where the 'const' is
actually checked by the hardware. You allocate it through
const char *str = iasprintf (...);
You use it like any 'const char *'.
You free it th