OK, I'm stumped on this one: dstep, struct, mixin, bitfields
Kagamin
spam at here.lot
Thu Mar 22 10:13:51 UTC 2018
On Wednesday, 21 March 2018 at 19:41:39 UTC, H. S. Teoh wrote:
> 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
> }
C code also uses `in`, `out` and `with` as identifiers.
I think, with some funny escape sequences we can do without any
keyword at all:
\1(all) { ... }
\1(none) { ... }
\1(Posix) { ... }
\1(Windows) { ... }
\5 version = getVersion();
\2 PacketHeader {
\6 version;
}
More information about the Digitalmars-d-learn
mailing list