bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: immutable string type


From: Paul Eggert
Subject: Re: immutable string type
Date: Sat, 28 Dec 2019 10:15:36 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2

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);
  [no changes to *p allowed here]
  imfree (p);

imfreeze can be a no-op unless debugging.

Oh, I see that Tim Rühsen has the same idea.

I prefer the prefix "im" to "i" for immutable, as plain "i" could stand for a
lot of things. (Plus, "imasprintf" rolls off the tongue better. :-)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]