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. :-)