Docs: Section on local variables

Stewart Gordon smjg_1998 at yahoo.com
Thu Apr 26 04:27:11 PDT 2012


On 26/04/2012 08:26, Timon Gehr wrote:
<snip>
> Another thing: It might not be unused in every static code path.

One way to deal with this would be to do the checking before conditional compilation. 
That said, I've a feeling that mixin expansion might get in the way of this.

> Even more important:
>
> template isInputRange(R)
> {
> enum bool isInputRange = is(typeof(
> {
> R r; // can define a range object
> if (r.empty) {} // can test for empty
> r.popFront(); // can invoke popFront()
> auto h = r.front; // can declare an unused variable
<snip>

cast(void) r.front;

Stewart.


More information about the Digitalmars-d-learn mailing list