Wednesday, January 17, 2018

Digest for comp.lang.c++@googlegroups.com - 3 updates in 3 topics

Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Jan 17 09:10PM

On Tue, 16 Jan 2018 20:21:01 -0600
> Auto will not work for function arguments.
 
Unless its a lambda expression.
Gareth Owen <gwowen@gmail.com>: Jan 17 09:47PM


> How often have you seen code which modifies a value parameter?
 
Very occasionally in things like
 
void do_something_n_times(int n)
{
while(n--) {
do_something_once();
}
}
ram@zedat.fu-berlin.de (Stefan Ram): Jan 16 11:58PM

>precisely the same reason, I declare them const according to the same
>policy I use for other local variables: they are const by default unless
>I plan to modify them.
 
"Use const whenever possible."
 
Scott Meyers
 
"Use const to define objects with values
that do not change after construction "
 
C++ Core Guideline; April 7, 2016;
Bjarne Stroustrup and Herb Sutter
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: