标签云

微信群

扫码加入我们

WeChat QR Code


That did the trick. Google reveals the compiler directive to be {$J+}. It's also in the project options, probably should have looked there :P

2019年02月23日10分16秒

Yeah I've been struck by that before. (edited to add details after my initial post)

2019年02月22日10分16秒

IMHO {$WRITABLECONST OFF} would be even betterer :) than {J+}.

2019年02月23日10分16秒

Right syntax is {$WRITEABLECONST ON} not {$WRITABLECONST ON} (sorry I can't edit answer).

2019年02月22日10分16秒

UliGerhardt it's on, not off as mentioned by SAMPro

2019年02月22日10分16秒

Barry - Would you have any information about why it's discouraged to use assignable constants? I for one really like the fact that local writable constants behave like global variables but are only visible within local scope.

2019年02月23日10分16秒

LievenKeersmaekers because constants are supposed to be constant.

2019年02月23日10分16秒

BarryKelly - lol, that was not my point. Name them whatever works for you :). I like the functionality they provide. All alternatives to typed constants are less consice then, well, typed constants.

2019年02月23日10分16秒

Keep in mind that this singleton pattern only works in single-thread environments. As the global memory used by the writeable const is shared between threads it can cause race conditions (stumbled over this with third-party components).

2019年02月23日10分16秒