TFPGList note: how to fix that? lazarus / 62-General ---------------------------------------------------------------------- OldPascal · 2021-04-27 11:52 I am testing the following code on free pascal compiler, Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program listtest; uses fgl, SysUtils;Type  TIntegerList = specialize TFPGList;Var  IntList: TIntegerList;  i: integer; begin   IntList := TIntegerList.Create;   IntList.Add(5);   IntList.Add(10);   IntList.Add(111);    for  i:=0 to IntList.count-1 do writeln(IntList[i]);   write('Press Enter to close...');  Readln;end.   It compiles but I get a lot of notes (warnings?), Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Free Pascal Compiler version 3.2.0 [2020/12/18] for x86_64Copyright (c) 1993-2020 by Florian Klaempfl and othersTarget OS: Linux for x86-64Compiling listtest.pasfgl.pp(1023,7) Note: Call to subroutine "function TFPGList.Add(const Item:SmallInt):LongInt;" marked as inline is not inlinedfgl.pp(1023,20) Note: Call to subroutine "function TFPGList.Get(Index:LongInt):SmallInt;" marked as inline is not inlinedlisttest.pas(12,4) Note: Call to subroutine "function TFPGList.Add(const Item:SmallInt):LongInt;" marked as inline is not inlinedlisttest.pas(13,4) Note: Call to subroutine "function TFPGList.Add(const Item:SmallInt):LongInt;" marked as inline is not inlinedlisttest.pas(14,4) Note: Call to subroutine "function TFPGList.Add(const Item:SmallInt):LongInt;" marked as inline is not inlinedlisttest.pas(16,54) Note: Call to subroutine "function TFPGList.Get(Index:LongInt):SmallInt;" marked as inline is not inlinedLinking listtest21 lines compiled, 0.3 sec6 note(s) issuedCompilation finished successfully.   How do I fix the source of notes/warnings?  A clean code does not generates those notes, therefore, I prefer to remove them. My objective is  for to  pascal generates a choice menu say 1) a 2) b 3) c 4) d where a...d are strings. using readln function the user inputs a list of listed numbers which can be one, three or all numbers.  Then I use the user listed numbers to sort the listed strings in the menu according to user's input.  But I have problem with a very simple task - initiating a list. ---------------------------------------------------------------------- trev · 2021-04-27 12:19 Before 3.2.0 the compiler did not report if it did not inline a function that was marked as inline. Now it does report that and more often than not even with a reason. This way one can see what is really inlined and what is not. (Source: Pascal Dragon) ---------------------------------------------------------------------- Thaddy · 2021-04-27 12:21 {$notes off} or from the commandline -vn- It is safe to ignore notes and usually safe to ignore hints (but not warnings) Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program listtest;{$notes off}You can also be more specific and define {$warn 3123 off} In that case that specific note (not inlined) is turned off. And at last, when compiling from source, simply do this in fgl.pp: {.$define FGLINLINE} That disables inlining and hence removes the notes. (Note: note the dot...) (And these numbers can be obtained by compiling with -vqlhn) The cleanest solution is 3123, but it is also the less used because most FPC programmers do not even know that option or how to apply it... That said.. it is fully documented. In an ideal world these numbers would be string consts, though. I also did a write-up about this in the wiki some years ago: https://wiki.freepascal.org/Turn_warnings_and_hints_on_or_off It is somewhat editted later by others...(NOT a smart idea, but so far it stays - about - correct. Not too much damage done, actually it is ruined...) My write-up above is more correct than the wiki. I will reverse those changes in the wiki. (Now playing Kill'em All ) https://en.wikipedia.org/wiki/Kill_%27Em_All ---------------------------------------------------------------------- OldPascal · 2021-04-27 23:56 Thanks for reply, I tried both methods {$notes off} and {$warn 3123 off} and only first one worked for me.  I still do not understand the inline thing.  I will probably continue my coding with the notes off setting but before I do so I will check out other alternatives of doing the same thing (making a list) without getting that note. ---------------------------------------------------------------------- trev · 2021-04-28 00:37 Quote from: OldPascal on April 28, 2021, 01:56:55 amI still do not understand the inline thing. From the Free Pascal Reference Guide: Quote14.9.5 inline Procedures that are declared inline are copied to the places where they are called. This has the effect that there is no actual procedure call, the code of the procedure is just copied to where the procedure is needed, this results in faster execution speed if the function or procedure is used a lot. It is obvious that inlining large functions does not make sense. By default, inline procedures are not allowed. Inline code must be enabled using the command-line switch -Si or {$inline on} directive. Remark     * inline is only a hint for the compiler. This does not automatically mean that all calls are inlined; sometimes the compiler may decide that a function simply cannot be inlined, or that a particular call to the function cannot be inlined. If so, the compiler will emit a warning.     * In old versions of Free Pascal, inline code was not exported from a unit. This meant that when calling an inline procedure from another unit, a normal procedure call will be performed. Only inside units, Inline procedures are really inlined. As of version 2.0.2, inline works across units.     * Recursive inline functions are not allowed. i. e. an inline function that calls itself is not allowed. ---------------------------------------------------------------------- PascalDragon · 2021-04-28 07:03 Quote from: OldPascal on April 28, 2021, 01:56:55 amThanks for reply, I tried both methods {$notes off} and {$warn 3123 off} and only first one worked for me.  I still do not understand the inline thing.  I will probably continue my coding with the notes off setting but before I do so I will check out other alternatives of doing the same thing (making a list) without getting that note. Note and Hint are the least severe verbosities that FPC provides messages for. In most cases you can simply ignore them (and sometimes you even can't do anything against them). Pay attention to Warning however.