Source-Changes-D archive

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

Re: CVS commit: xsrc/external/mit/libpciaccess/dist/src



On Sun, Nov 04, 2012 at 08:44:01AM +0200, Alan Barrett wrote:
> On Fri, 02 Nov 2012, David Young wrote:
> >>Modified Files:
> >>    xsrc/external/mit/libpciaccess/dist/src: common_interface.c
> >>
> >>Log Message:
> >>Remove useless extra "const" in "const sometype const * var = value;".
> >>Foundusing clang -Wduplicate-decl-specifier.
> >
> >Maybe 'const sometype * const var' was intended, i.e., a "single
> >assignment" semantic?  I've probably mistyped that myself several times.
> 
> The variable is assigned only once, so that would work,
> but it's in a small block where I don't think it would add any clarity.

Personally I almost never mark variables 'const', the only I initialise
in their declarations (at the top of a function) are probably almost
always never chaned (well maybe execpt default error values).

Marking function parameters 'const' is also pointless, some compilers
verify that the definition in the headers file matches - which is
partitularly pointless since the called object code isn't required
to avoid modifying the argument memory/register (which might sometimes
be a useful optimistation).

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index