[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251117-transparent-exotic-myna-bd77c9-mkl@pengutronix.de>
Date: Mon, 17 Nov 2025 17:34:20 +0100
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Stéphane Grosjean <stephane.grosjean@...e.fr>
Cc: Vincent Mailhol <mailhol@...nel.org>,
Oliver Hartkopp <socketcan@...tkopp.net>, linux-can@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH RFC 1/3] can: calc_bittiming: get rid of the incorrect
"nominal" word
On 17.11.2025 16:32:31, Stéphane Grosjean wrote:
> > >> 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.
...and this is exactly what I want to express, because it's the
reference value.
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists