Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

No warning on un-initialized record fields

 Post Reply Post Reply
Author
Mertelmeyer Jens View Drop Down
New Member
New Member
Avatar

Joined: 30 Jul 2018
Posts: 1
Post Options Post Options   Quote Mertelmeyer Jens Quote  Post ReplyReply Direct Link To This Post Topic: No warning on un-initialized record fields
    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. 

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down