[fpc-pascal] Wrong assignment detected only run time without warning
giuliano.colla at fastwebnet.it
Fri Jun 16 12:55:03 CEST 2023
I made a stupid error. My code:
TFileObj = Class(TObject)
procedure TForm1.FillDir(FileData : TSearchRec);
FFIleObj.Size := FileData.Size;
but TSearchRec structure is:
TRawbyteSearchRec = Record
Size : Int64;
IOW I assign an int64 to an integer.
But when compiling I don't get any warning about that, and when the
program runs there's no problem until the FileData.Size fits into an
integer. When FileData.Size gets too large if compiled with -Co I get a
range exception, if compiled without I just get wrong value for Size.
Is that the intended behavior of compiler?
Platform Linux CentOs 7 - fpc 3.2.2
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal