[PATCH] constify static arrays of strings

Thorsten Glaser t.glaser at tarent.de
Fri Oct 1 04:10:56 AEST 2021


On Thu, 30 Sep 2021, Mike Frysinger wrote:

> By marking these static & the array itself as const, the data is moved

> -	static const char *rhosts_files[] = {".shosts", ".rhosts", NULL};
> +	static const char * const rhosts_files[] = {".shosts", ".rhosts", NULL};

Is this really true nowadays? I thought with PIC/PIE, these are
relocations and therefore neither constant nor shared/shareable,
at least for some architectures (i386?).

But it’s nevertheless a good idea, of course.

bye,
//mirabilos
-- 
Sometimes they [people] care too much: pretty printers [and syntax highligh-
ting, d.A.] mechanically produce pretty output that accentuates irrelevant
detail in the program, which is as sensible as putting all the prepositions
in English text in bold font.	-- Rob Pike in "Notes on Programming in C"


More information about the openssh-unix-dev mailing list