<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_ym19_1_1466491419634_12865" dir="ltr"><span>> </span><span style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;" id="yui_3_16_0_ym19_1_1466491419634_12913">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?</span></div><div></div><div id="yui_3_16_0_ym19_1_1466491419634_12864"> </div><div class="signature" id="yui_3_16_0_ym19_1_1466491419634_12826"><div id="yui_3_16_0_ym19_1_1466491419634_12868" dir="ltr">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. :)</div><div id="yui_3_16_0_ym19_1_1466491419634_12868"><br></div><div id="yui_3_16_0_ym19_1_1466491419634_12868">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.</div><div id="yui_3_16_0_ym19_1_1466491419634_12868"><br></div><div id="yui_3_16_0_ym19_1_1466491419634_12868"><br></div>–Mr Bee<div id="yui_3_16_0_ym19_1_1466491419634_12825"><br></div></div> <div class="qtdSeparateBR" id="yui_3_16_0_ym19_1_1466491419634_12909"><br><br></div><div class="yahoo_quoted" id="yui_3_16_0_ym19_1_1466491419634_12887" style="display: block;"> <div style="font-family: HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" id="yui_3_16_0_ym19_1_1466491419634_12886"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" id="yui_3_16_0_ym19_1_1466491419634_12885"> <div dir="ltr" id="yui_3_16_0_ym19_1_1466491419634_12884"><font size="2" face="Arial" id="yui_3_16_0_ym19_1_1466491419634_12908"> Pada Selasa, 21 Juni 2016 13:15, Marc Hanisch <marc.hanisch@googlemail.com> menulis:<br></font></div> <br><br> <div class="y_msg_container" id="yui_3_16_0_ym19_1_1466491419634_12892"><div id="yiv1182557615"><div id="yui_3_16_0_ym19_1_1466491419634_12891"><div dir="ltr" id="yui_3_16_0_ym19_1_1466491419634_12895">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!<div id="yui_3_16_0_ym19_1_1466491419634_12907"><br clear="none"></div><div id="yui_3_16_0_ym19_1_1466491419634_12897">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?</div><div id="yui_3_16_0_ym19_1_1466491419634_12896"><br clear="none"></div><div id="yui_3_16_0_ym19_1_1466491419634_12894">Best regards,</div><div id="yui_3_16_0_ym19_1_1466491419634_13497">Marc</div></div><div class="yiv1182557615gmail_extra" id="yui_3_16_0_ym19_1_1466491419634_12890"><br clear="none"><div class="yiv1182557615gmail_quote" id="yui_3_16_0_ym19_1_1466491419634_12889">2016-06-21 7:47 GMT+02:00 Michalis Kamburelis <span dir="ltr" id="yui_3_16_0_ym19_1_1466491419634_13495"><<a rel="nofollow" shape="rect" ymailto="mailto:michalis.kambi@gmail.com" target="_blank" href="mailto:michalis.kambi@gmail.com" id="yui_3_16_0_ym19_1_1466491419634_13494">michalis.kambi@gmail.com</a>></span>:<br clear="none"><div class="yiv1182557615yqt7502508347" id="yiv1182557615yqt51433"><blockquote class="yiv1182557615gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;" id="yui_3_16_0_ym19_1_1466491419634_12888">2016-06-20 5:31 GMT+02:00 Mr Bee <<a rel="nofollow" shape="rect" ymailto="mailto:pak.lebah@yahoo.com" target="_blank" href="mailto:pak.lebah@yahoo.com">pak.lebah@yahoo.com</a>>:<br clear="none">
[...]<br clear="none">
<span class="yiv1182557615" id="yui_3_16_0_ym19_1_1466491419634_13496">> I have a little suggestion though. I prefer to use {$J-} directive in my<br clear="none">
> Pascal program. I think it encourages good programming practice in Pascal.<br clear="none">
> The {$J-} means constant is a constant no matter how you declare it. To bad<br clear="none">
> FPC is still using {$J+} as the default even in the {$MODE OBJFPC}, which<br clear="none">
> means a constant becomes a variable once you include the data type<br clear="none">
> eventhough it's declared within a 'const' block. CMIIW.<br clear="none">
><br clear="none">
<br clear="none">
</span>Ouch. For some reason, I thought that {$J-} is the default in {$mode<br clear="none">
objfpc} since years, and we have left that mistake behind us. Quick<br clear="none">
test showed me that I was mistaken. This makes a *lot* of my code less<br clear="none">
safe that I assumed, as in many recent projects I didn't bother to<br clear="none">
explicitly use {$J-}.<br clear="none">
<br clear="none">
This is an excellent suggestion then, thank you. I updated the<br clear="none">
document to encourage everywhere doing<br clear="none">
<br clear="none">
{$mode objfpc}{$H+}{$J-}<br clear="none">
<br clear="none">
at the beginning.<br clear="none">
<br clear="none">
I definitely *do not want* to explain to any new programmer what a<br clear="none">
"writeable constant" is... This concept should remain buried:)<br clear="none">
<div class="yiv1182557615HOEnZb"><div class="yiv1182557615h5"><br clear="none">
Regards,<br clear="none">
Michalis<br clear="none">
_______________________________________________<br clear="none">
fpc-pascal maillist - <a rel="nofollow" shape="rect" ymailto="mailto:fpc-pascal@lists.freepascal.org" target="_blank" href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a><br clear="none">
<a rel="nofollow" shape="rect" target="_blank" href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a><br clear="none">
</div></div></blockquote></div></div><br clear="none"></div></div></div><br><div class="yqt7502508347" id="yqt08588">_______________________________________________<br clear="none">fpc-pascal maillist - <a shape="rect" ymailto="mailto:fpc-pascal@lists.freepascal.org" href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a><br clear="none"><a shape="rect" href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal" target="_blank">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a></div><br><br></div> </div> </div> </div></div></body></html>