[Issue 8634] Anonymous function parameters

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 9 07:01:29 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8634



--- Comment #2 from Maxim Fomin <maxim at maxim-fomin.ru> 2012-09-09 07:02:06 PDT ---
(In reply to comment #1)
> (In reply to comment #0)
> > void foo(int)
> > {
> > 
> > }
> > 
> > void main()
> > {
> >     foo(5);
> > }
> > 
> > Although anonymous function parameters may be used in function declarations, it
> > seems that dmd doesn't check whether a function declaration is a definition
> > too.
> 
> What's the problem here?
> 
> foo() not giving a name to its first argument means the programmer is stating
> foo() never uses its first argument, and the D language allows the programmer
> to enforce this desire.
> 
> This feature also allows to avoid "unused argument warnings" once/where such
> warning is available.

The problem is that such code is likely to be a bug (parameter name was
forgotten) and compiler should report about this. BTW dmd doesn't produce any
warning for unused variable.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list