> Maybe a little bit offtopic, but I have a question regarding the compiler >directives: is there a way to tell Lazarus to use these directives in every >new unit? I even expect a bit further. These {$MODE OBJFPC}, {$H+}, and {$J-} >directives should be the *default* directives for every new FPC >programs/units. We're now using Free Pascal compiler on 2016. Why do we need >to explicitly declare Free Pascal mode in a Free Pascal program? In 21st >century, our string should not be limited to 255 chars anymore. And what the >hell is "writable constant"? It's contradictio in terminis. :) If somehow someone want to deals with those things, let them use the appropriate directives explicitly. But for most programs we build today, those things should be the default.
–Mr Bee Pada Selasa, 21 Juni 2016 13:15, Marc Hanisch <marc.hani...@googlemail.com> menulis: Thanks Michalis for your excellent work! It's very important to left the early 90s associated with Pascal programming behind us and to encourage new developers to have a look onto the modern aspects of Object Pascal! Maybe a little bit offtopic, but I have a question regarding the compiler directives: is there a way to tell Lazarus to use these directives in every new unit? Best regards,Marc 2016-06-21 7:47 GMT+02:00 Michalis Kamburelis <michalis.ka...@gmail.com>: 2016-06-20 5:31 GMT+02:00 Mr Bee <pak.le...@yahoo.com>: [...] > I have a little suggestion though. I prefer to use {$J-} directive in my > Pascal program. I think it encourages good programming practice in Pascal. > The {$J-} means constant is a constant no matter how you declare it. To bad > FPC is still using {$J+} as the default even in the {$MODE OBJFPC}, which > means a constant becomes a variable once you include the data type > eventhough it's declared within a 'const' block. CMIIW. > Ouch. For some reason, I thought that {$J-} is the default in {$mode objfpc} since years, and we have left that mistake behind us. Quick test showed me that I was mistaken. This makes a *lot* of my code less safe that I assumed, as in many recent projects I didn't bother to explicitly use {$J-}. This is an excellent suggestion then, thank you. I updated the document to encourage everywhere doing {$mode objfpc}{$H+}{$J-} at the beginning. I definitely *do not want* to explain to any new programmer what a "writeable constant" is... This concept should remain buried:) Regards, Michalis _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal