Re: [hackers] [dwm][PATCH] move config data to read-only sections

From: Laslo Hunhold <dev_AT_frign.de>
Date: Thu, 7 Sep 2017 10:03:51 +0200

On Wed, 6 Sep 2017 19:04:47 +0000
<Joachim.Henke_AT_t-systems.com> wrote:

Dear Joachim,

> > Well, C might not have the most beautiful syntax in this regard,
> > but I see no other way to make a pointer itself read-only (and
> > especially the ...cmd[] pointer arrays really should be). Would
> > using a typedef for that be more comfortable to you?
>
> Are you suggesting to typedef const char *const coChar; or something
> similar and then using coChar in those places? I would still prefer
> the old way for readability reasons. There is no real impact either
> imho.

I would also oppose a typedef. You may not see the const after the *
very often, but it would still take more time to look up what a certain
type StrPtrWhatever_t means.

I like the approach of this patch and given that it really brings
benefits, there is no reason not to merge it.
This may be an example of where the C type system comes to its limits,
but as you already said well, the principles of information security
apply well here.

With best regards

Laslo

-- 
Laslo Hunhold <dev_AT_frign.de>
Received on Thu Sep 07 2017 - 10:03:51 CEST

This archive was generated by hypermail 2.3.0 : Thu Sep 07 2017 - 10:12:20 CEST