OK, I'm stumped on this one: dstep, struct, mixin, bitfields

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Mar 21 19:41:39 UTC 2018


On Wed, Mar 21, 2018 at 07:30:28PM +0000, Russel Winder via Digitalmars-d-learn wrote:
[...]
> But :-(
> 
> Why does version have to be a keyword?
[...]

	version(all) { ... }
	version(none) { ... }
	version(Posix) { ... }
	version(Windows) { ... }

But yeah, using "version" for this purpose makes the very common
identifier "version" unavailable for use.  I've been bitten by this
multiple times.

	auto version = getVersion();	// NG
	auto ver = getVersion();	// OK

	struct PacketHeader {
		ushort version;		// NG
		ushort ver;		// OK
	}

:-(


T

-- 
Маленькие детки - маленькие бедки.


More information about the Digitalmars-d-learn mailing list