[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1277298823.655244587.1763393551815.JavaMail.root@zimbra65-e11.priv.proxad.net>
Date: Mon, 17 Nov 2025 16:32:31 +0100 (CET)
From: Stéphane Grosjean <stephane.grosjean@...e.fr>
To: Vincent Mailhol <mailhol@...nel.org>
Cc: Oliver Hartkopp <socketcan@...tkopp.net>, linux-can@...r.kernel.org,
linux-kernel@...r.kernel.org, Marc Kleine-Budde <mkl@...gutronix.de>
Subject: Re: [PATCH RFC 1/3] can: calc_bittiming: get rid of the incorrect
"nominal" word
Hello again Vincent,
(Sorry all, I can only slowly work through the list of emails from this weekend.)
> >> static int
> >> can_update_sample_point(const struct can_bittiming_const *btc,
> >> - const unsigned int sample_point_nominal, const unsigned int
> >> tseg,
> >> + unsigned int sp_origin, unsigned int tseg,
> >
> > Please don't remove the "const".
> I always considered it silly to tag a scalar parameter as const.
> Because C
> passes the function argument by value, it is pretty meaningless.
The "const" attribute means that the parameter cannot be used on the left side of an assignment in its block. Even if this parameter is not an input/output parameter, without “const” it can be modified within the function, just like a local variable (which it is, since it is theoretically also declared on the stack). Explicitly stating “const” is a strong indicator that the value cannot be modified in the block imho.
> Yours sincerely,
> Vincent Mailhol
>
Best regards,
-- Stéphane
Powered by blists - more mailing lists