Review needed for the wiki - Pascal to D page

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 4 18:22:30 PST 2014


On Fri, Dec 05, 2014 at 03:39:07AM +0200, ketmar via Digitalmars-d wrote:
[...]
> also, it's worth noting that Delphi's IFDEF/ENDIF completely ignores
> everything inbetwee if condition is false, but D `version` and `static
> if` requires ignored code to be correct D code nevertheless.
[...]

That's not completely true. All that's required is that the code can be
parsed successfully. It can be semantically nonsense and the compiler
wouldn't care, for example this will compile, even though it's complete
garbage:

	version(none) {
		NonExistentType x = nonExistentVar;
		static assert(0);
		NoType YesParsingStillContinuesHere()(z = y+w ? 1 : "")
			if (is(a == b)) // a and b are nonsense symbols
		in { static assert(0); }
		body {
			gar(bage) = hahaha(cast(el)ation);
			{{{}}{}{{}}}
		}
		pragma(no, such, __trait(nonsense));
	}


T

-- 
Любишь кататься - люби и саночки возить. 


More information about the Digitalmars-d mailing list