Re: [fpc-pascal] Debian, Jessie, Linux64 failed to install FPC3.0 64bit

2016-10-10 Thread Zaher Dirkey
this one of mirrors i used

ftp://gd.tuwien.ac.at/languages/pascal/fpc/dist/3.0.0/x86_64-linux/

On Mon, Oct 10, 2016 at 9:11 AM, Zaher Dirkey  wrote:

> Hi i tried to install FPC 64 but in Debian 64 bit but i feel it currpted,
> i downloaded it from individual mirror but same.
> It finished with strange name encoded file like in picture (attached) and
> bad file format for fpc execute file
>
> ​I uses "sh install.sh" in /usr directoy
>
> Is there any good copy to use?
>
> ​
> [image: Inline image 1]
> Best Regards
> Zaher Dirkey
>



-- 
I am using last revision of Lazarus, FPC 3.0 on Windows8.1

Best Regards
Zaher Dirkey
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] Using for-loop index variable after loop

2016-10-10 Thread Juha Manninen
I have always avoided using a for-loop index variable after the loop.
I thought its value can be unpredictable in some situations when the
compiler reuses its register or memory etc.

I noticed the ActionListEditor in Lazarus sources has code that uses
it after the loop.
The compiler, FPC 3.0, does not warn about it.
I made a small test:

procedure MyProcedure;
var
  i: Integer;
begin
  for i := 0 to 5 do
WriteLn('iii ', i);
  Write('After loop i=', i);
  if i = 5 then
WriteLn(' as expected')
  else
WriteLn(' which is unpredictable');
end;

Indeed, no warning!
Is it OK to do that? Have I misunderstood it?

Juha
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Using for-loop index variable after loop

2016-10-10 Thread Jonas Maebe


Juha Manninen wrote on Mon, 10 Oct 2016:


I have always avoided using a for-loop index variable after the loop.
I thought its value can be unpredictable in some situations when the
compiler reuses its register or memory etc.


That is correct.


The compiler, FPC 3.0, does not warn about it.


Indeed: http://bugs.freepascal.org/view.php?id=12508


Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Using for-loop index variable after loop

2016-10-10 Thread Vojtěch Čihák

Hi, if you mean this:
 
function CategoryIndexOf(Name: String): Integer;
  var
    i: Integer;
  begin
    for i:= lstCategory.Items.Count-1 downto 0 do begin
      if lstCategory.Items[i] = Name
      then Break;
    end;
    Result := i;
    if (i = lstCategory.Items.IndexOf(cActionListEditorUnknownCategory))
       and (i = lstCategory.Items.IndexOf(cActionListEditorAllCategory))
    then Result := 0;
  end;
 
It can IMO cause random and hardly reproducible bugs.
 
V.
__

Od: Juha Manninen 
Komu: FPC-Pascal users discussions 
Datum: 10.10.2016 12:16
Předmět: [fpc-pascal] Using for-loop index variable after loop


I have always avoided using a for-loop index variable after the loop.
I thought its value can be unpredictable in some situations when the
compiler reuses its register or memory etc.

I noticed the ActionListEditor in Lazarus sources has code that uses it after 
the loop.

Juha
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal 


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Smart Link definition ?

2016-10-10 Thread fredvs
Hello.

Could you, please, help me ?

Does somebody know if smart-link (-XX) is done by the compiler (fpc) or by
the linker (ld) ?

Many thanks.

Fre;D



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Smart-Link-definition-tp5726480p5726511.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Using for-loop index variable after loop

2016-10-10 Thread Juha Manninen
On Mon, Oct 10, 2016 at 3:07 PM, Vojtěch Čihák  wrote:
> Hi, if you mean this:
> ...

Yes, that is one of them.
The code does not make sense in any case, regardless of "i"'s value.
Index for cActionListEditorUnknownCategory and
cActionListEditorAllCategory differ.
"i" cannot have both at the same time. Maybe the condition should be
"or", not "and".
Why does it not compare Name directly with
cActionListEditorUnknownCategory and cActionListEditorAllCategory
constants?

There are many similar fishy code blocks. I will sanitize some of them ...

Juha
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Smart Link definition ?

2016-10-10 Thread Jonas Maebe

On 10/10/16 16:25, fredvs wrote:

Does somebody know if smart-link (-XX) is done by the compiler (fpc) or by
the linker (ld) ?


It's done by the linker, but it is based on how the compiler 
structures/annotates the code and data when you compile with -CX.



Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Smart Link definition ?

2016-10-10 Thread denisgolovan
Sorry, for the question, but is it really working for FPC+Lazarus?
I mean FPC with smart-linking from trunk.

Last time I tried, I could not complete full FPC and Lazarus rebuild.

BR,
Denis

10.10.2016, 18:03, "Jonas Maebe" :
> On 10/10/16 16:25, fredvs wrote:
>>  Does somebody know if smart-link (-XX) is done by the compiler (fpc) or by
>>  the linker (ld) ?
>
> It's done by the linker, but it is based on how the compiler
> structures/annotates the code and data when you compile with -CX.
>
> Jonas
> ___
> fpc-pascal maillist - fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

-- 
Regards,
Denis Golovan
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Smart Link definition ?

2016-10-10 Thread leledumbo
> Sorry, for the question, but is it really working for FPC+Lazarus?

Yes, links fine here, just eating quite significant amount of RAM.



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Smart-Link-definition-tp5726480p5726515.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Smart Link definition ?

2016-10-10 Thread fredvs
> It's done by the linker, but it is based on how the compiler 
> structures/annotates the code and data when you compile with -CX. 

OK, perfect.

Many thanks.




-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Smart-Link-definition-tp5726480p5726516.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Smart Link definition ?

2016-10-10 Thread fredvs
> Sorry, for the question, but is it really working for FPC+Lazarus? 

For Windows64+32, Linux64+32 it is working here perfectly.
For FreeBSD, it is in discussion. ;-)

> Yes  just eating quite significant amount of RAM.
Ooops, I did not knew this...
Thanks for the tip.

Fre;D 




-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Smart-Link-definition-tp5726480p5726517.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Smart Link definition ?

2016-10-10 Thread fredvs
Huh, sorry, it is me again...

About ld (the linker).

In ld doc:
http://sourceware.org/binutils/docs-2.16/ld/Options.html
  

=> -X --discard-locals
Delete all temporary local symbols. For most targets, this is all local
symbols whose names begin with L.

I guess that the fpc compiler option -CX is using that ld option -X to
"smart-link" their program.
Without any "customization" (yes/no ?).

If so, ld is responsable of the "smart-linking" and fpc has nothing to do
with it (yes/no ?).

And, of course, if it is the case, it should be the responsibility of ld to
take care about the sym-link that he creates. (yes/no?)

Many thanks. 

Fre;D



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Smart-Link-definition-tp5726480p5726518.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Smart link in FreeBSD multi-arch ?

2016-10-10 Thread Michael Schnell

On 07.10.2016 17:19, Graeme Geldenhuys wrote:


  there goes my
idea of using RPi's as small stand-alone servers. :-/


Pi 3 does feature a 64 Bit CPU. (AFAIK, no 64 Bit Linux for same, yet. 
BSD: no idea)


-Michael
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Smart Link definition ?

2016-10-10 Thread LacaK

Hi,
What is difference between "Link smart (-XX)" and "Smart linkable (-XC)" ?
-XC is by default off and corresponds to per unit {$SMARTLINK OFF/ON} ?

Does it means, that compiler/linker is trying "Link smart", but only 
units marked "Smart linkable" ?
Which means, that when I use in my program StrUtils or SysUtils and I 
use only one function from these unit, in my program executable will be 
all function presented in these units ?


Thanks
-Laco.



Does somebody know if smart-link (-XX) is done by the compiler (fpc) 
or by

the linker (ld) ?


It's done by the linker, but it is based on how the compiler 
structures/annotates the code and data when you compile with -CX.




___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Using for-loop index variable after loop

2016-10-10 Thread Virgo Pärna
On Mon, 10 Oct 2016 14:07:35 +0200, Vojtěch Čihák  
wrote:
>       then Break;
>  

Isn't leaving for loop with break only case, where loop variable
will keep the value. Otherwise it is undefined. 
But it does make the code more confusing.

-- 
Virgo Pärna 
virgo.pa...@mail.ee

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Smart Link definition ?

2016-10-10 Thread Jonas Maebe
fredvs wrote:

> In ld doc:
> http://sourceware.org/binutils/docs-2.16/ld/Options.html
>   
> 
> => -X --discard-locals
> Delete all temporary local symbols. For most targets, this is all local
> symbols whose names begin with L.
> 
> I guess that the fpc compiler option -CX is using that ld option -X to
> "smart-link" their program.
> Without any "customization" (yes/no ?).
> 
> If so, ld is responsable of the "smart-linking" and fpc has nothing to do
> with it (yes/no ?).

None of the above has anything to do with smart linking/dead code
stripping. It's about removing symbols (not the code/data they point to)
from the symbol table of the linked program.


Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Smart Link definition ?

2016-10-10 Thread Jonas Maebe
LacaK wrote:

> What is difference between "Link smart (-XX)" and "Smart linkable (-XC)" ?
> -XC is by default off and corresponds to per unit {$SMARTLINK OFF/ON} ?

-CX (not -XC) means "generate code that can be smart linked by the
linker if you specify -XX while compiling a program that uses this unit".

> Does it means, that compiler/linker is trying "Link smart", but only
> units marked "Smart linkable" ?

Yes.

> Which means, that when I use in my program StrUtils or SysUtils and I
> use only one function from these unit, in my program executable will be
> all function presented in these units ?

The top-level FPC makefile builds all units smart-linkable if the target
OS is one of "win32 go32v2 linux freebsd netbsd openbsd netware netwlibc
darwin". I guess win64 should be added to that list (once someone
verifies this doesn't cause test suite regressions).


Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] LowerCase vs. UnicodeLowerCase

2016-10-10 Thread LacaK
One problem is, that documentation of SysUtils.LowerCase is not correct 
regarding to System.LowerCase

http://www.freepascal.org/docs-html/rtl/sysutils/lowercase.html :
"... It is completely equivalent to the *lowercase function of the 
system unit*"


But another problem, which I have pointed out, is that UnicodeString 
version of SysUtils.LowerCase hides System.LowerCase,
while SysUtils.LowerCase converts only A..Z but System.LowerCase uses 
widestringmanager so converts also accented characters.
So System.LowerCase is superset of SysUtils.LowerCase, but in most 
programs is hidden by SysUtils.


What seems to me logical, is oposite, that System unit has basic 
functionality, which is extended by SysUtils.
Now System unit has extended capability that is hidden by basic 
functionality of SysUtils ;-)


-Laco.


writeln(LowerCase(US)); // prints ÁÉÍ
writeln(UnicodeLowerCase(US)); // prints áéí

Why first LowerCase() does nothing while second wroks as expected?


SysUtils.LowerCase is only supposed to work on ascii characters.
 From manual:
---
LowerCase returns the lowercase equivalent of S. Ansi characters are not
taken into account, only ASCII codes below 127 are converted. It is
completely equivalent to the lowercase function of the system unit, and
is provided for compatibility only.
---
But that last sentence suggests that System.LowerCase should work same
way. But it's manual entry says:
---
Lowercase returns the lowercase version of its argument C. If its
argument is a string, then the complete string is converted to
lowercase. The type of the returned value is the same as the type of the
argument.
---
So, which version is correct one? Delphi LowerCase also only
works on ascii characters.


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal