Dscanner: intentionally unused variable

Jacob Carlborg doob at me.com
Sun Jan 7 16:14:11 UTC 2018


On 2018-01-07 01:18, Ivan Trombley wrote:
> While working with SDL, I found that I kept using the same pattern over 
> and over:
> - Get the current clip rectangle.
> - Set a new clip rectangle.
> - restore the old clip rectangle on scope (exit).
> 
> Instead of writing that code again and again, I wrote a simple function 
> that returns a struct which restores the old clip rectangle in it's 
> destructor. This works great but now dscanner complains about the 
> variable being unused.
> 
> Is there a way tell dscanner that a variable is intentionally unused?

I don't know about D-Scanner but I know that other similar tools allow 
you to prefix the name of a variable with an underscore to indicate that 
the variable is intentionally unused.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list