bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 4/5] qualify constant with the const


From: Samuel Thibault
Subject: Re: [PATCH 4/5] qualify constant with the const
Date: Mon, 16 Sep 2013 09:37:16 +0200
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Marin Ramesa, le Mon 16 Sep 2013 08:09:44 +0200, a écrit :
> Yes, but the const protects the copy. It expresses the intent of the 
> function. It's like saying to the caller: "I will behave nicely and not 
> modify the passed value during my execution." Then the caller knows 
> that the value of the variable after the function is the same that was 
> in the function.

Again, for a scalar, the callee is always given a copy of the argument.
So it does not matter whether the callee modifies it or not, the
caller's value will never change.

It does make sense when the callee is given a pointer to something which
it does not modify.

Samuel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]