Method without result


#1

Oxygene .2275 .NET. Would you consider this to be a compiler bug? It would be useful to trap the omission:

method returnbyte: byte;
var
b : byte;
begin
b := 5;
end;

There’s no result := b statement, so the method does nothing. Easy to forget when coding.


(marc hoffman) #2

no. result is implicitly preinitialized to default(type). this is valid code and will return 0.