[fpc-pascal] {$J} default setting for today

Mr Bee pak.lebah at yahoo.com
Sat Feb 20 10:33:15 CET 2016


Hi, I read this: http://www.freepascal.org/docs-html/ref/refse10.html
"Support for assigning values to typed constants is controlled by the {$J} directive: it can be switched off, but is on by default (for Turbo Pascal compatibility). Initialized variables are always allowed."
Then I read this: http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/devcommon/compdirswriteabletypedconstants_xml.html
"In early versions of Delphi and Object Pascal, typed constants were always writeable, corresponding to the {$J+} state. Old source code that uses writeable typed constants must be compiled in the {$J+} state, but for new applications it is recommended that you use initialized variables and compile your code in the {$J-} state."
I think we should follow Delphi in this case. Typed constant should not be writeable by default. That's what a constant should be. The old behavior is a flaw. At least let {$J-} be the default for {$MODE DELPHI} and {$MODE OBJFPC}.
What do you think?
–Mr Bee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160220/d3a4da5e/attachment.html>


More information about the fpc-pascal mailing list