monotone-devel
[Top][All Lists]
Advanced

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

Re: [Monotone-devel] 'warning: unused parameter'


From: Stephen Leake
Subject: Re: [Monotone-devel] 'warning: unused parameter'
Date: Wed, 30 Apr 2014 03:49:24 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (windows-nt)

Stephen Leake <address@hidden> writes:

> The code that generates this is in simplestring_xform.hh:
>
> template<> inline
> origin::type get_made_from<std::string>(std::string const & thing)
> {
>   return origin::internal;
> }
>
> Is there a way to mark 'thing' as unused? or do we have to disable that
> warning with -Wno-unused-parameter?

I found three answers on stack overflow:

1) comment out or delete the parameter name:

    a) origin::type get_made_from<std::string>(std::string const & /* thing */)

    b) origin::type get_made_from<std::string>(std::string const & )

2) cast it to void:

    (void)thing;

I prefer 1a; it most clearly documents that we know there is a parameter
by that name, but we are not using it in this case. Any objections?

-- 
-- Stephe



reply via email to

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