[fpc-pascal] Class constructor called unconditionally

Vojtěch Čihák vojtech.cihak at atlas.cz
Thu Mar 31 15:58:33 CEST 2016


IMO compilers should be dogmatic otherwise one cannot rely on them. This looks to me like advocating wrong optimization.
 
Blaazen
______________________________________________________________
> Od: silvioprog <silvioprog at gmail.com>
> Komu: "FPC-Pascal users discussions" <fpc-pascal at lists.freepascal.org>
> Datum: 31.03.2016 15:33
> Předmět: [fpc-pascal] Class constructor called unconditionally
>
 As long as you don't use the class anywhere outside the class itself, the compiler takes this as the class not used at all and hence won't call the class constructor. So I guess you have to use the intialization section instead of tweaking the code to fool the compiler. Take the pragmatic approach instead of the dogmatic one. It will be more readable anyway.-- 
Silvio Clécio

----------

_______________________________________________
fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal <http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160331/35c0ec7e/attachment.html>


More information about the fpc-pascal mailing list