标签云

微信群

扫码加入我们

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

2018年09月27日44分12秒

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

2018年09月26日44分12秒

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

2018年09月27日44分12秒

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

2018年09月26日44分12秒

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

2018年09月26日44分12秒

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.

2018年09月27日44分12秒

LievenKeersmaekers because constants are supposed to be constant.

2018年09月27日44分12秒

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.

2018年09月27日44分12秒

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).

2018年09月27日44分12秒