Recent

Author Topic: borderline errorneous error message  (Read 1158 times)

dseligo

  • Hero Member
  • *****
  • Posts: 1345
Re: borderline errorneous error message
« Reply #15 on: July 04, 2024, 02:37:57 pm »
No. The compiler MUST expect a character because p is a pointer to a character.  It cannot expect anything else which is why the message is erroneous.  The compiler isn't resolving the expected type correctly.

And what should be expected in my example (reply #5) in lines 8 and 9 (both operands are variables)?
My point is: when you evaluate equation, types of operators must be compatible and their order doesn't matter. So you can't say that because one operator is variable and one operator is constant, variable's type is expected type. Maybe wording of error could be different: Error: Incompatible types: can't compare "Char" with "QWord"
« Last Edit: July 04, 2024, 02:39:48 pm by dseligo »

Khrys

  • Jr. Member
  • **
  • Posts: 82
Re: borderline errorneous error message
« Reply #16 on: July 04, 2024, 02:52:28 pm »
While it's true that  $90  is definitely not a char constant
Absolute and utter Nonsense: it falls firmly in the range $00-$FF.

The compiler is right, your notation is incorrect;
Code: Pascal  [Select][+][-]
  1. // [...]
  2.   while p^ = #$90 do //  <---- here     { $90 is not a char, but #$90 is!!! }
  3. // [...]
         

Stop contradicting yourself, Thaddy. You yourself said that  $90  is not a char, but  #$90  is. You added the "but" part in the code comment without removing the preceding original statement that  "$90 is not a char", so you agree with it.

Thaddy

  • Hero Member
  • *****
  • Posts: 15553
  • Censorship about opinions does not belong here.
Re: borderline errorneous error message
« Reply #17 on: July 04, 2024, 03:10:37 pm »
Either you can't read or there is a language problem and that is not on my side.
The correct answer was given in my first reply. The rest makes no sense.
« Last Edit: July 04, 2024, 03:12:58 pm by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

440bx

  • Hero Member
  • *****
  • Posts: 4486
Re: borderline errorneous error message
« Reply #18 on: July 04, 2024, 03:15:42 pm »
And what should be expected in my example (reply #5) in lines 8 and 9 (both operands are variables)?
The answer to that is simple: the lvalue determines the expected and _required_ type of the rvalue.  That's it. no ifs, no buts, no parse it from middle to the top or any other "creative" hallucination.

My point is: when you evaluate equation, types of operators must be compatible and their order doesn't matter.
That's as incorrect as claiming that 1 + 1 = 73.  order _matters_.  expressions are parsed left to right and associations are made based on operator precedence. 

The error message FPC outputs in the example I provided is strictly speaking incorrect but, at least it figured out something is wrong and said something (incorrect) to that effect.

ETA:

An improvement would be "illegal expression" (which the compiler often uses and, in this case, at least wouldn't be wrong.)

« Last Edit: July 04, 2024, 03:17:39 pm by 440bx »
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Khrys

  • Jr. Member
  • **
  • Posts: 82
Re: borderline errorneous error message
« Reply #19 on: July 04, 2024, 03:18:44 pm »
Either you can't read or there is a language problem and that is not on my side.
Please elaborate. For future visitors of this thread, becaues I'm not going to argue with you further. Obviously you are always right and everyone else is always wrong - how foolish of me to dare challenge Thaddy the Great.

jamie

  • Hero Member
  • *****
  • Posts: 6529
Re: borderline errorneous error message
« Reply #20 on: July 04, 2024, 09:24:13 pm »
Either you can't read or there is a language problem and that is not on my side.
Please elaborate. For future visitors of this thread, becaues I'm not going to argue with you further. Obviously you are always right and everyone else is always wrong - how foolish of me to dare challenge Thaddy the Great.

Please do what I did, Block him. It will save years on your life.

The blocking feature isn't perfect, it does need to be improved on, but it's better than nothing.
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018