why ; ?

BCS BCS at pathlink.com
Mon May 5 09:17:35 PDT 2008


downs wrote:

> void main() { writefln("Hello World") int a float b = 4 writefln(a, " - ", b) return 0 }
> 

eyes.. bleeding..

Please don't do that.

Another (non style) reason to have the ; is that it provides a bit of 
redundancy in the code. This results in you needing 2 errors before it 
compile wrong rather than just one


int j = 6;
void main()
{
	bob();
	writef("%d", j); // 5 or 6?
}

void bob()
{
	int i j = 5	// this could be

	//int i, j = 5; // declare i and j as local var
	//int i; j = 5; // declare i and modify .j

}



More information about the Digitalmars-d mailing list