Print Page | Close Window

No warning on un-initialized record fields

Printed From: TMS Software
Category: Developer Tools
Forum Name: DEV FixInsight
Forum Discription:
URL: http://www.tmssoftware.com/site/forum/forum_posts.asp?TID=11228
Printed Date: 22 Nov 2019 at 2:27pm


Topic: No warning on un-initialized record fields
Posted By: Mertelmeyer Jens
Subject: No warning on un-initialized record fields
Date Posted: 30 Jul 2018 at 5:27pm
Consider the following:

 type

TStruct = record

someByte: Byte;

end;

 

function getStruct(): TStruct;

begin

// do nothing

end;

 

Procedure p();

begin

WriteLn( getStruct().someByte );

end;


I believe there should be a warning that "someByte" has never been initialized. I fell for that much too often in Delphi. 




Print Page | Close Window