Topic: unused attribute


Author: Matthew Woehlke <mw_triad@users.sourceforge.net>
Date: Thu, 01 May 2014 10:10:05 -0400
Raw View
On 2014-04-30 22:42, David Krauss wrote:
> On 2014-04-30, at 11:21 PM, Matthew Woehlke wrote:
>> There's also the issue that not naming the argument makes the code
>> harder to read ("what's this argument that you don't care about?").
>
> I think that's solved by having a function prototype naming the
> variable, and leaving it anonymous only in the definition.

No, because then I still have to go look up the declaration to know what
the parameter is supposed to be.

Although, on further consideration, this point is readily solved either
way like:

   void foo(int /*unused*/) {...}

....i.e. name the parameter in a comment.

--
Matthew

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: gmisocpp@gmail.com
Date: Thu, 1 May 2014 17:28:43 -0700 (PDT)
Raw View
------=_Part_310_8585967.1398990523803
Content-Type: text/plain; charset=UTF-8

Hi

On Friday, May 2, 2014 2:10:05 AM UTC+12, Matthew Woehlke wrote:
>
> On 2014-04-30 22:42, David Krauss wrote:
> > On 2014-04-30, at 11:21 PM, Matthew Woehlke wrote:
> >> There's also the issue that not naming the argument makes the code
> >> harder to read ("what's this argument that you don't care about?").
> >
> > I think that's solved by having a function prototype naming the
> > variable, and leaving it anonymous only in the definition.
>
> No, because then I still have to go look up the declaration to know what
> the parameter is supposed to be.
>
> Although, on further consideration, this point is readily solved either
> way like:
>
>    void foo(int /*unused*/) {...}
>
> ...i.e. name the parameter in a comment.
>
Funny, you are correct that is the obvious solution to the documentation
problem, that didn't occur to me. lol

>
> --
> Matthew
>
>

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_310_8585967.1398990523803
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi<br><br>On Friday, May 2, 2014 2:10:05 AM UTC+12, Matthe=
w Woehlke wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px =
0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border=
-left-width: 1px; border-left-style: solid;">On 2014-04-30 22:42, David Kra=
uss wrote:
<br>&gt; On 2014-04-30, at 11:21 PM, Matthew Woehlke wrote:
<br>&gt;&gt; There's also the issue that not naming the argument makes the =
code
<br>&gt;&gt; harder to read ("what's this argument that you don't care abou=
t?").
<br>&gt;
<br>&gt; I think that's solved by having a function prototype naming the
<br>&gt; variable, and leaving it anonymous only in the definition.
<br>
<br>No, because then I still have to go look up the declaration to know wha=
t=20
<br>the parameter is supposed to be.
<br>
<br>Although, on further consideration, this point is readily solved either=
=20
<br>way like:
<br>
<br>&nbsp; &nbsp;void foo(int /*unused*/) {...}
<br>
<br>...i.e. name the parameter in a comment.
<br></blockquote><div>Funny, you are correct that is the obvious solution t=
o the documentation problem, that didn't occur to me. lol&nbsp;</div><block=
quote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-lef=
t: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; bord=
er-left-style: solid;">
<br>--=20
<br>Matthew
<br>
<br></blockquote></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_310_8585967.1398990523803--

.


Author: Tony V E <tvaneerd@gmail.com>
Date: Fri, 2 May 2014 13:36:36 -0400
Raw View
--001a11c3d9d434257004f86e3937
Content-Type: text/plain; charset=UTF-8

On Thu, May 1, 2014 at 8:28 PM, <gmisocpp@gmail.com> wrote:

>
> Although, on further consideration, this point is readily solved either
>> way like:
>>
>>    void foo(int /*unused*/) {...}
>>
>> ...i.e. name the parameter in a comment.
>>
> Funny, you are correct that is the obvious solution to the documentation
> problem, that didn't occur to me. lol
>
>>
>>

It is an often used solution.  However, anyone who likes to use /* ... */
to comment out large swathes of code, gets really annoyed by "inner" /* */
comments.
(I'm not one of those, but I work with some, and commented-params have been
complained about)

Tony

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--001a11c3d9d434257004f86e3937
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On Thu, May 1, 2014 at 8:28 PM,  <span dir=3D"ltr">&lt;<a href=3D"m=
ailto:gmisocpp@gmail.com" target=3D"_blank">gmisocpp@gmail.com</a>&gt;</spa=
n> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><br><div class=3D""><blockq=
uote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;padding-left:1=
ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-sty=
le:solid">
Although, on further consideration, this point is readily solved either=20
<br>way like:
<br>
<br>=C2=A0 =C2=A0void foo(int /*unused*/) {...}
<br>
<br>...i.e. name the parameter in a comment.
<br></blockquote></div><div>Funny, you are correct that is the obvious solu=
tion to the documentation problem, that didn&#39;t occur to me. lol=C2=A0</=
div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;pad=
ding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;bord=
er-left-style:solid">

<span class=3D"HOEnZb"><font color=3D"#888888"></font></span><br></blockquo=
te></div></blockquote></div><br><br></div><div class=3D"gmail_extra">It is =
an often used solution.=C2=A0 However, anyone who likes to use /* ... */ to=
 comment out large swathes of code, gets really annoyed by &quot;inner&quot=
; /* */ comments.<br>
</div><div class=3D"gmail_extra">(I&#39;m not one of those, but I work with=
 some, and commented-params have been complained about)<br><br>Tony<br><br>=
</div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a11c3d9d434257004f86e3937--

.


Author: =?UTF-8?Q?David_Rodr=C3=ADguez_Ibeas?= <dibeas@ieee.org>
Date: Fri, 2 May 2014 16:10:59 -0400
Raw View
--001a11c3cdee4e644704f870610e
Content-Type: text/plain; charset=UTF-8

There are different alternatives for those that don't like some peculiarity
of one of the solutions:

- macro that expands to nothing:
#define UNUSED(x)
void f(int UNUSED(count));

- comment:
void f(int /*count*/);
void f(int,       // count [better looking with other arguments, each in
one line :)]
        );

- not naming it:
void f(int);
   // the first argument represents the 'count' and is not used

- just give it a name in the declaration, not the definition:
void f(int count);
void f(int) { ... }

- give it a name in both places, but silence the warning:
void f(int count) {
   (void)count;
   ...
}

If there is a code base where none of the different approaches work...
well, get over it and pick one :)

Of all of them, the one that should always be used (possibly in combination
with others) is the comment: you should document your functions.

    David


On Fri, May 2, 2014 at 1:36 PM, Tony V E <tvaneerd@gmail.com> wrote:

>
>
>
> On Thu, May 1, 2014 at 8:28 PM, <gmisocpp@gmail.com> wrote:
>
>>
>> Although, on further consideration, this point is readily solved either
>>> way like:
>>>
>>>    void foo(int /*unused*/) {...}
>>>
>>> ...i.e. name the parameter in a comment.
>>>
>> Funny, you are correct that is the obvious solution to the documentation
>> problem, that didn't occur to me. lol
>>
>>>
>>>
>
> It is an often used solution.  However, anyone who likes to use /* ... */
> to comment out large swathes of code, gets really annoyed by "inner" /* */
> comments.
> (I'm not one of those, but I work with some, and commented-params have
> been complained about)
>
> Tony
>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--001a11c3cdee4e644704f870610e
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">There are different alternatives for those that don&#39;t =
like some peculiarity of one of the solutions:<br><br>- macro that expands =
to nothing:<br>#define UNUSED(x)<br>void f(int UNUSED(count));<br><br>- com=
ment:<br>
void f(int /*count*/);<br>void f(int, =C2=A0 =C2=A0 =C2=A0 // count [better=
 looking with other arguments, each in one line :)]<div>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 );<br><br>- not naming it:<br>void f(int);<br>=C2=A0 =C2=A0// th=
e first argument represents the &#39;count&#39; and is not used<br>
<br>- just give it a name in the declaration, not the definition:<br>void f=
(int count);<br>void f(int) { ... }<br><br>- give it a name in both places,=
 but silence the warning:<br>void f(int count) {<br>=C2=A0 =C2=A0(void)coun=
t;<br>
=C2=A0 =C2=A0...<br>}<br><br>If there is a code base where none of the diff=
erent approaches work... well, get over it and pick one :)<br><br>Of all of=
 them, the one that should always be used (possibly in combination with oth=
ers) is the comment: you should document your functions.</div>
<div><br>=C2=A0 =C2=A0 David<br></div></div><div class=3D"gmail_extra"><br>=
<br><div class=3D"gmail_quote">On Fri, May 2, 2014 at 1:36 PM, Tony V E <sp=
an dir=3D"ltr">&lt;<a href=3D"mailto:tvaneerd@gmail.com" target=3D"_blank">=
tvaneerd@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><br><div class=3D"gmail_ext=
ra"><br><br><div class=3D"gmail_quote">On Thu, May 1, 2014 at 8:28 PM,  <sp=
an dir=3D"ltr">&lt;<a href=3D"mailto:gmisocpp@gmail.com" target=3D"_blank">=
gmisocpp@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><br><div><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;padding-left:1ex;border-=
left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid">

Although, on further consideration, this point is readily solved either=20
<br>way like:
<br>
<br>=C2=A0 =C2=A0void foo(int /*unused*/) {...}
<br>
<br>...i.e. name the parameter in a comment.
<br></blockquote></div><div>Funny, you are correct that is the obvious solu=
tion to the documentation problem, that didn&#39;t occur to me. lol=C2=A0</=
div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;pad=
ding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;bord=
er-left-style:solid">


<span><font color=3D"#888888"></font></span><br></blockquote></div></blockq=
uote></div><br><br></div><div class=3D"gmail_extra">It is an often used sol=
ution.=C2=A0 However, anyone who likes to use /* ... */ to comment out larg=
e swathes of code, gets really annoyed by &quot;inner&quot; /* */ comments.=
<br>

</div><div class=3D"gmail_extra">(I&#39;m not one of those, but I work with=
 some, and commented-params have been complained about)<span class=3D"HOEnZ=
b"><font color=3D"#888888"><br><br>Tony<br><br></font></span></div></div><s=
pan class=3D"HOEnZb"><font color=3D"#888888">

<p></p>

-- <br>
<br>
--- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</font></span></blockquote></div><br></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a11c3cdee4e644704f870610e--

.


Author: David Krauss <potswa@gmail.com>
Date: Sat, 3 May 2014 12:40:44 +0800
Raw View
On 2014-05-03, at 4:10 AM, David Rodr=EDguez Ibeas <dibeas@ieee.org> wrote:

> Of all of them, the one that should always be used (possibly in combinati=
on with others) is the comment: you should document your functions.

I had assumed that the discussion was about documentation generators like D=
oxygen, which parse prototypes.

I don't think C++ should enter the solution space which is already well-cov=
ered by such markup tools. Better cooperation with tools is a good idea, bu=
t no such issues have been raised here.

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

.


Author: Jim Porter <jvp4846@g.rit.edu>
Date: Fri, 2 May 2014 22:18:30 -0700 (PDT)
Raw View
------=_Part_1450_16108158.1399094310207
Content-Type: text/plain; charset=UTF-8

On Friday, May 2, 2014 12:36:36 PM UTC-5, Tony V E wrote:

> It is an often used solution.  However, anyone who likes to use /* ... */
> to comment out large swathes of code, gets really annoyed by "inner" /* */
> comments.
> (I'm not one of those, but I work with some, and commented-params have
> been complained about)
>

That's what #if 0 is for. ;) (Not that I want to encourage people to use
the preprocessor more...)

- Jim

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_1450_16108158.1399094310207
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Friday, May 2, 2014 12:36:36 PM UTC-5, Tony V E wrote:<=
br><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;=
border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>It is=
 an often used solution.&nbsp; However, anyone who likes to use /* ... */ t=
o comment out large swathes of code, gets really annoyed by "inner" /* */ c=
omments.<br>
</div><div>(I'm not one of those, but I work with some, and commented-param=
s have been complained about)<br></div></div></blockquote><div><br>That's w=
hat #if 0 is for. ;) (Not that I want to encourage people to use the prepro=
cessor more...)<br><br>- Jim <br></div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_1450_16108158.1399094310207--

.