Recent

Author Topic: What does this message mean?  (Read 6221 times)

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
What does this message mean?
« on: March 21, 2018, 11:31:38 am »
i get the following message in my message window after compiling.
What does it mean because i never had this before.
Quote
referee_main.pas(132,10) Hint: Call to subroutine "operator :=(const source:Variant):Word;" marked as inline is not inlined

You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: What does this message mean?
« Reply #1 on: March 21, 2018, 11:40:48 am »
The operator is not inlined, because you use a variant. Variants need resolution handling. In this case this may not even be resolved in the future. Avoid variants.
Unless your method is called not too often: then it is ok, but such methods can't be inlined.
The compiler simply tells you: "you want inline but I have no way to make this inlined."

Variants are convenient but slow by default and there is no way you can speed that up if you use a variant type. They need run-time evaluation.
It may also be the case that operators can't be inlined in general. I have to test that on some platforms. But when you use variants you basically kill any way of inlining.

And this is all rather basic.....
« Last Edit: March 21, 2018, 11:53:28 am by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: What does this message mean?
« Reply #2 on: March 21, 2018, 11:59:39 am »
It is strange though. Because i use the same code in 1.8.2 and now i am using a trunk version of lazarus (aka 1.9.0) and then i get this message.
Same code but different version
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: What does this message mean?
« Reply #3 on: March 21, 2018, 02:48:17 pm »
It is strange though. Because i use the same code in 1.8.2 and now i am using a trunk version of lazarus (aka 1.9.0) and then i get this message.
Same code but different version

I can see your frustration, but any earlier versions did not inline as well. At least now you'll get a message.
And it is FPC (the compiler), not Lazarus that can not handle such constructs. (Nor can GNU C++ or MSVC for that matter with variants).
Variants are essentially run-time typed. And inline is not more than a hint to the compiler. https://freepascal.org/docs-html/ref/refsu73.html
If I see variants, I always will look at alternatives: it is almost never a good idea (but I use them myself in mostly db applications, it is not a sin, just slow).
« Last Edit: March 21, 2018, 03:20:37 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: What does this message mean?
« Reply #4 on: March 26, 2018, 12:05:52 am »
But i use this function (which also gives the error) to lookup things in a table.
It's a variant on the Delphi-function DLookUp

Code: Pascal  [Select][+][-]
  1. function MLookup(Veld, Tabel, Voorwaarde: string): variant;
  2. var mySql: TSQLQuery;
  3. begin
  4.   mySQl := TSQLQuery.Create(nil);
  5.   mySQl.DataBase := Form_RefereeMain.Connect_RefereeDB;
  6.   try
  7.     mySql.SQL.Text := Format('SELECT %s FROM %s WHERE %s', [veld, tabel, voorwaarde]);
  8.     mySql.Open;
  9.     Result := mySQL.Fields[0].AsVariant;
  10.   finally
  11.     MySql.Free;
  12.   end;
  13. end;     // Lookup    
Is there an alternative for this?
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

jamie

  • Hero Member
  • *****
  • Posts: 6130
Re: What does this message mean?
« Reply #5 on: March 26, 2018, 02:02:39 am »
I don't know a lot about database stuff but..

 I just looked in my help file for Delphi and it states the TdataSet does not support any of the

"As....." properties unless you subclass them, however, the "VALUE" property is a variant and seems to be
supported out of the box..

Try this

 
Code: Pascal  [Select][+][-]
  1.  Result := MySQL.Fields[0].Value;
  2.  

 There is also "OldValue" the value before the now "Value"
The only true wisdom is knowing you know nothing

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: What does this message mean?
« Reply #6 on: March 26, 2018, 11:57:24 am »
No that's not going to change anything because the function returns a variant and the hint will stay there (not inlined).


This function was designed to be able to return any variable.
That was also the case with the Delphi DLookUp.


To bad the compiler marks it as not inlined
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: What does this message mean?
« Reply #7 on: March 26, 2018, 12:02:46 pm »
No that's not going to change anything because the function returns a variant and the hint will stay there (not inlined).


This function was designed to be able to return any variable.
That was also the case with the Delphi DLookUp.


To bad the compiler marks it as not inlined
two main questions
1) what do you expect the inline to do exactly?
2) what makes you think that the delphi function is inlined in the first place?
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: What does this message mean?
« Reply #8 on: March 26, 2018, 12:11:47 pm »
Delphi does not inline code with variants used on the variant type itself. It is just less verbose in its warnings. It does some inlining on utility routines where the underlying type is not a variant but can be used in the context of variants. I believe FPC can do the same in such scenario's.
Actually FPC can inline more code than non-llvm Delphi can at this point in time. I am not quite sure about the llvm targets.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

jamie

  • Hero Member
  • *****
  • Posts: 6130
Re: What does this message mean?
« Reply #9 on: March 26, 2018, 11:49:16 pm »
if it's just a compiler warning you are so worried about then you can use
{%H-} at the location or something like that.
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018