www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Bug? Please compile the code "DMD32 D Compiler v2.065"

reply "sdvcn" <sdvcn 126.com> writes:
"DMD32 D Compiler v2.065
Copyright (c) 1999-2013 by Digital Mars written by Walter Bright
Documentation: http://dlang.org/"

code:


import std.stdio;

int main(string[] argv)
{
	bool  bh ;
	int ll;
	for(size_t n;n<99;n++)
	{
		int a= 5;
		int b = 5;

		auto r = (a != b);		// return r:false

		if(a != b)
		{
			ll = 55;
			bh = false;// Are executed at any time ??????????
			//i+=
			//break;
		}
	}

     writeln("ll:",ll);
	writeln("bh:",bh);
     return 0;
}

return :
ll:0
bh:false
Apr 13 2014
parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Monday, 14 April 2014 at 03:13:31 UTC, sdvcn wrote:
 			bh = false;// Are executed at any time ??????????
That's never executed, but bh is automatically initialized to false when you declare it which is why you get bh:false at the end.
Apr 13 2014
parent "sdvcn" <sdvcn 126.com> writes:
On Monday, 14 April 2014 at 03:17:54 UTC, Adam D. Ruppe wrote:
 On Monday, 14 April 2014 at 03:13:31 UTC, sdvcn wrote:
 			bh = false;// Are executed at any time ??????????
That's never executed, but bh is automatically initialized to false when you declare it which is why you get bh:false at the end.
sorry,I made a mistake should be
Apr 13 2014