Am 11.03.2013 02:31 schrieb "Flávio Etrusco" <flavio.etru...@gmail.com>: > > On Sun, Mar 10, 2013 at 6:08 PM, Sven Barth <pascaldra...@googlemail.com> wrote: > > On 10.03.2013 20:39, Flávio Etrusco wrote: > >> > >> I'd really like the compiler would stop with an error if it can't > >> prove a variable/out/result is initialized. > >> Did anybody try implementing this in FPC? > > > > > > Have fun fixing the errors then: > > > > === example begin === > > > > type > > TTest = record > > t: LongInt; > > end; > > var > > t: TTest; > > begin > > FillChar(t, SizeOf(t), 0); > > end; > > > > === example end === > > > > The above code will have the hint that "t" is not initalized. > > > > Regards, > > Sven > > t.t := 0; // ;-)
I don't consider this a nice solution... > This reminds me that a magic compiler procedure to zero-fill records > without the sizeof parameter (and without the hint) has always been on > my wishlist :-) (now I'll have to dig the message where sb explained > why FillChar couldn't be declared with 'out' - IIRC something > regarding interfaces) In 2.7.1 (implemented for around three quarter of a year): === example begin === t := Default(TTest); === example end === Regards, Sven
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel