* * *

Author Topic: Assign int64 to int32 shows no warnings at compilation time.  (Read 194 times)

dmitryb

  • New member
  • *
  • Posts: 22
Assign int64 to int32 shows no warnings at compilation time.
« on: September 16, 2018, 09:45:26 pm »
The compilation of the following code does not show any warnings.

Code: Pascal  [Select]
  1. procedure TForm1.Button9Click(Sender: TObject);
  2. var
  3.   d64: Int64;
  4.   d32: Int32;
  5. begin
  6.   d64 := Int64.MaxValue;
  7.   d32 := d64;    
  8. end;

Is it possible to have warnings when the assignment has a potential overflow?

Xor-el

  • Full Member
  • ***
  • Posts: 154
Re: Assign int64 to int32 shows no warnings at compilation time.
« Reply #1 on: September 16, 2018, 10:41:15 pm »
did you enable range and overflow check?

dmitryb

  • New member
  • *
  • Posts: 22
Re: Assign int64 to int32 shows no warnings at compilation time.
« Reply #2 on: September 16, 2018, 10:44:00 pm »
Yes, but it only affects the runtime, does not it?

Xor-el

  • Full Member
  • ***
  • Posts: 154
Re: Assign int64 to int32 shows no warnings at compilation time.
« Reply #3 on: September 16, 2018, 11:35:33 pm »
Yes, but it only affects the runtime, does not it?

yes..

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus