Re: [hackers] [dwm][PATCH RESEND 0/2] Const-correctness fixes
Hi Quentin,
Quentin Rameau writes:
>Those don't “cast away constantness”, they are just cast.
Hmm? For example, for the FC/Xft types, fontname is declared as const by
xfont_create, but then we cast away its constness when passing it to
FCNameParse. The same goes for text, which we claim is const in the
drw_font_getexts signature, but then we remove its constness.
In general the existing code seems confused, no? Either we shouldn't pass them
in as const in the first place, or we should maintain the constness that we
declare in the function parameters.
There shouldn't be any logical change here, but it seems weird to say things
are not mutable up front and then waver about it later. Right now there's no
UB, but making sure we don't cast away the const mitigates the risk altogether.
Received on Mon Aug 22 2022 - 12:15:19 CEST
This archive was generated by hypermail 2.3.0
: Mon Aug 22 2022 - 12:24:47 CEST