Recent

Author Topic: min() function behavior inconsistent  (Read 2005 times)

jamie

  • Hero Member
  • *****
  • Posts: 6077
Re: min() function behavior inconsistent
« Reply #15 on: May 31, 2023, 01:11:44 am »
I just created that function in old DELPHI 3.0 and 10 which already has all the overloads etc.

 All the constant translations work as they should.

 The mind set of some as how this should work is either flawed or the code is not fixable for some reason?

  I kind of wish they would work on this because it would be very helpful in debugging code.

   oh well, what can you expect for free! I would say a lot of the DEV's are getting to old for this! :o
The only true wisdom is knowing you know nothing

dsiders

  • Hero Member
  • *****
  • Posts: 1045
Re: min() function behavior inconsistent
« Reply #16 on: May 31, 2023, 02:40:45 am »
About type-safety and implicit type conversion:
Code: Pascal  [Select][+][-]
  1. var
  2.     b: byte;
  3.     c: char;
  4.     d: double;
  5.     s: single;
  6. . . .
  7.  
  8.     b := c;  // is not compiled
  9.     b := byte(c);  // is compiled
  10.     c := b;   // is not compiled
  11.     c := char(b);  // is compiled
  12.     d := s;  // is compiled
  13.     d := double(s);  // is not compiled
  14.     s := d;  // is compiled
  15.     s := single(d);  // is not compiled

Isn't this a mess?  :D

Did you attach it as a test case to a bug report?
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

jamie

  • Hero Member
  • *****
  • Posts: 6077
Re: min() function behavior inconsistent
« Reply #17 on: May 31, 2023, 03:09:02 am »
I just checked D, those are all valid.
The only true wisdom is knowing you know nothing

han

  • Jr. Member
  • **
  • Posts: 96
Re: min() function behavior inconsistent
« Reply #18 on: May 31, 2023, 09:36:34 am »
My initial problem was already reported one year ago as an issue:

https://gitlab.com/freepascal.org/fpc/source/-/issues/39729

tetrastes

  • Sr. Member
  • ****
  • Posts: 469
Re: min() function behavior inconsistent
« Reply #19 on: May 31, 2023, 10:17:25 am »
Did you attach it as a test case to a bug report?

No, I think it's not related to the choose of overloaded functions.

 

TinyPortal © 2005-2018