Re: [fpc-pascal] Result: string
El 04/03/2013 22:16, Michael Van Canneyt escribió: That report says the issue was assigned to Jonas and fixed in revision 20427 (ver 2.6.1). I find the current release (2.6.2) initialises a string function result to EmptyStr as you would hope. [...] Prints AA Hello, I'm asking because today I has updated my old 2.7.1 SVN since 8-9 months and a library starts to fail and the "bug" was the Result string which enters the function with a value while it does not happend in the old one. If Result as string is not initialized a warning should be issued do not ? This happends in your simple test, but I was unable to find it in the library that I'm using. The code that makes me wonder something is wrong is this one: --- {$mode objfpc} {$h+} procedure TheB(var aTheA: string); begin aTheA:=aTheA+'A'; end; function TheA(): string; begin //Result:=''; TheB(Result); end; Var C : String; begin C:='B'; C:=TheA; C:=TheA; Writeln('= "',C,'"'); end. --- In this situation no warning happends and result is different if I uncomment the "Result:='';" line. I think the missing warning is a bug, the missing warning or the non initialization. -- ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Result: string
On Mon, Mar 4, 2013 at 5:23 PM, Juha Manninen wrote: > On Mon, Mar 4, 2013 at 9:21 PM, José Mejuto wrote: >> What's the expected output of this code ? >> >> function TheA(): string; >> begin >> Result:=Result+'A'; >> end; >> >> writeln(TheA()); >> >> I thought that when the result type is an automated one its value gets >> initialized... Maybe I'm wrong... > > Yes you are wrong. It is very illogical because a local string > variable is initialized to be empty but the return value is not. > Delphi has the same problem. > > I once made even a report about it: > http://bugs.freepascal.org/view.php?id=20907 > > > Regards, > Juha Delphi would present this problem "only" in some situations (which is worse), and it didn't even show a warning when the result is a string :-/ -Flávio ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Result: string
On Mon, Mar 4, 2013 at 10:51 PM, Howard Page-Clark wrote: > That report says the issue was assigned to Jonas and fixed in revision 20427 > (ver 2.6.1). > I find the current release (2.6.2) initialises a string function result to > EmptyStr as you would hope. Ok, that sounds good. I must have misunderstood what was changed. I thought it was the warning only but apparently the fundamental issue was fixed. Juha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Result: string
On Mon, 4 Mar 2013, Howard Page-Clark wrote: On 04/03/13 8:23, Juha Manninen wrote: On Mon, Mar 4, 2013 at 9:21 PM, José Mejuto wrote: What's the expected output of this code ? function TheA(): string; begin Result:=Result+'A'; end; writeln(TheA()); I thought that when the result type is an automated one its value gets initialized... Maybe I'm wrong... Yes you are wrong. It is very illogical because a local string variable is initialized to be empty but the return value is not. Delphi has the same problem. I once made even a report about it: http://bugs.freepascal.org/view.php?id=20907 That report says the issue was assigned to Jonas and fixed in revision 20427 (ver 2.6.1). I find the current release (2.6.2) initialises a string function result to EmptyStr as you would hope. {$mode objfpc} {$h+} function TheA(): string; begin Result:=Result+'A'; end; Var C : String; begin C:='B'; C:=TheA; C:=TheA; Writeln(C); end. Prints AA Michael.___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Get variable name at runtime
Am 04.03.2013 14:39, schrieb dhkblas...@zeelandnet.nl: Hi, How can I retrieve a variable name at runtime? I know about RTTI on classes, what about simple type variables? It's not possible. Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Result: string
On 04/03/13 8:23, Juha Manninen wrote: On Mon, Mar 4, 2013 at 9:21 PM, José Mejuto wrote: What's the expected output of this code ? function TheA(): string; begin Result:=Result+'A'; end; writeln(TheA()); I thought that when the result type is an automated one its value gets initialized... Maybe I'm wrong... Yes you are wrong. It is very illogical because a local string variable is initialized to be empty but the return value is not. Delphi has the same problem. I once made even a report about it: http://bugs.freepascal.org/view.php?id=20907 That report says the issue was assigned to Jonas and fixed in revision 20427 (ver 2.6.1). I find the current release (2.6.2) initialises a string function result to EmptyStr as you would hope. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Result: string
On Mon, Mar 4, 2013 at 9:21 PM, José Mejuto wrote: > What's the expected output of this code ? > > function TheA(): string; > begin > Result:=Result+'A'; > end; > > writeln(TheA()); > > I thought that when the result type is an automated one its value gets > initialized... Maybe I'm wrong... Yes you are wrong. It is very illogical because a local string variable is initialized to be empty but the return value is not. Delphi has the same problem. I once made even a report about it: http://bugs.freepascal.org/view.php?id=20907 Regards, Juha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Object pascal language compatiblity - was: Does FPC 2.8.0 can actually still be called Pascal ?
Am 04.03.2013 01:24, schrieb Dimitri Smits: > > > - Oorspronkelijk e-mail - >> Van: "Florian Klämpfl" Aan: "FPC-Pascal >> users discussions" Verzonden: >> Vrijdag 1 maart 2013 18:13:42 Onderwerp: Re: [fpc-pascal] Object >> pascal language compatiblity - was: Does FPC 2.8.0 can actually >> still be called Pascal ? >> >> Am 01.03.2013 11:04, schrieb Sven Barth: >>> >>> But even if LLVM would support all targets that FPC supports the >>> core developers don't *want* to make LLVM the default. >> >> Actually, I wouldn't have any interest working on a compiler using >> llvm as a backend because it leaves only the boring front end work >> :) Not to mention the maintainance problems when depending on an >> external cg written not in pascal, the probably significant speed >> drop etc. >> > > as a matter of fact, the llvm-stack is not just your front-end to > provide the intermediate bytecode (or textual variant)! You can > provide/maintain multiple plugins for almost every "pass". Going from > optimisation passes to the entire "executable generation" as > back-end. Admittedly you need to make a C(++?) compatible interface, > but I think nobody stops you from making those passes/plugins in > FPC... And how does this change the fact that it is an external cg not written in pascal? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Result: string
Hello, What's the expected output of this code ? function TheA(): string; begin Result:=Result+'A'; end; writeln(TheA()); I thought that when the result type is an automated one its value gets initialized... Maybe I'm wrong... -- ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FreeBSD failure compiling fpdoc 2.7.1
In our previous episode, Graeme Geldenhuys said: > Below is the script I use to compile FPC 2.7.1. I am using FPC 2.6.0 > (I noticed it is still allowed for a while, even though 2.6.2 is out). This is normal, pass -Fl/usr/local/lib in opt (for releases, makepack from fpcbuild does this) Also see http://www.stack.nl/~marcov/buildfaq/#toc-Subsection-1.6.4 ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] FreeBSD failure compiling fpdoc 2.7.1
Hi, Below is the script I use to compile FPC 2.7.1. I am using FPC 2.6.0 (I noticed it is still allowed for a while, even though 2.6.2 is out). --[ go.sh ] #!/usr/local/bin/bash TARGET=x86_64-freebsd COMPILER=/data/devel/fpc-2.6.0/$TARGET/bin/ppcx64 gmake clean gmake all -j 5 FPMAKEOPT="-T 8" FPC=$COMPILER gmake install INSTALL_PREFIX=/data/devel/fpc-2.7.1/$TARGET/ FPC=$COMPILER --[ end ]- The compiling of fpdoc fails with a linking error. Unable to find libiconv, but what exactly is it looking for? If you look further down my email, the libiconv *is* installed on my FreeBSD system, in the usual location of /usr/local/lib/ So what am I missing, to resolve this compilation issue? --- ...snip... gmake[3]: Entering directory `/data/devel/fpc-2.7.1/src/utils/fpdoc' ../bin2obj -o css.inc -c DefaultCSS fpdoc.css ../bin2obj -o plusimage.inc -c PlusImageData images/plus.png ../bin2obj -o minusimage.inc -c MinusImageData images/minus.png /data/devel/fpc-2.7.1/src/compiler/ppcx64 -Ur -Xs -O2 -n -S2h -Fu/data/devel/fpc-2.7.1/src/rtl/units/x86_64-freebsd -Fu/data/devel/fpc-2.7.1/src/packages/paszlib/units/x86_64-freebsd -Fu/data/devel/fpc-2.7.1/src/packages/fcl-process/units/x86_64-freebsd -Fu/data/devel/fpc-2.7.1/src/packages/hash/units/x86_64-freebsd -Fu/data/devel/fpc-2.7.1/src/packages/fpmkunit/units/x86_64-freebsd -Fu/data/devel/fpc-2.7.1/src/packages/fcl-res/units/x86_64-freebsd -Fu/data/devel/fpc-2.7.1/src/packages/fcl-base/units/x86_64-freebsd -Fu/data/devel/fpc-2.7.1/src/packages/fcl-xml/units/x86_64-freebsd -Fu/data/devel/fpc-2.7.1/src/packages/fcl-passrc/units/x86_64-freebsd -Fu/data/devel/fpc-2.7.1/src/packages/chm/units/x86_64-freebsd -FE. -FUunits/x86_64-freebsd -Cg -dx86_64 -dRELEASE fpdoc.pp /usr/bin/ld: cannot find -liconv fpdoc.pp(404,1) Error: Error while linking fpdoc.pp(404,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted gmake[3]: *** [fpdoc] Error 1 gmake[3]: Leaving directory `/data/devel/fpc-2.7.1/src/utils/fpdoc' gmake[2]: *** [fpdoc_all] Error 2 gmake[2]: Leaving directory `/data/devel/fpc-2.7.1/src/utils' gmake[1]: *** [utils_all] Error 2 gmake[1]: Leaving directory `/data/devel/fpc-2.7.1/src' gmake: *** [build-stamp.x86_64-freebsd] Error 2 [src (master)]$ [src (master)]$ ls -l /usr/local/lib/libiconv* -rw-r--r-- 1 root wheel 1116648 5 Jan 18:36 /usr/local/lib/libiconv.a -r--r--r-- 1 root wheel 918 5 Jan 18:36 /usr/local/lib/libiconv.la lrwxr-xr-x 1 root wheel 13 5 Jan 18:36 /usr/local/lib/libiconv.so -> libiconv.so.3 -r--r--r-- 1 root wheel 1084538 5 Jan 18:36 /usr/local/lib/libiconv.so.3 --[ end ]- -- Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Bootstrap binaries
On Mon, Mar 4, 2013 at 6:19 AM, Marco van de Voort wrote: > In our previous episode, Joao Morais said: >> How ftp://ftp.freepascal.org/pub/fpc/dist/2.6.2/bootstrap >> like lists are built? I missed at least i386-linux and i386-win32 >> binaries. > > They are simply the compiler binary extracted from the release in a bzipped > format. Which is a big plus compared with ~50MB packages. Such packages help in creating a maintainable snapshot environment from scratch. > Win32/64 in particular is useless, since there you need the binutils in the > release package anyway. Because of that I also maintain a checkout of fpcbuild/install/binwXX of the current release under Windows. Btw the win binaries are harder to take, since they are installers and afaics the compiler cannot be extracted without executing the installation process. Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Re: warning: link.res contains output sections; did you forget -T?
OOT: How to try the new internal linker? -Xi doesn't seem to trigger it. I see in the changelog it works on *BSD, does it work on linux? -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/warning-link-res-contains-output-sections-did-you-forget-T-tp5713334p5713343.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/mailman/listinfo/fpc-pascal
[fpc-pascal] Get variable name at runtime
Hi, How can I retrieve a variable name at runtime? I know about RTTI on classes, what about simple type variables? Regards, Darius ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] warning: link.res contains output sections; did you forget -T?
Sorry, I misunderstood the -T warning with the other linker FAQ. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Daemon - OnStop and OnDestroy events never fired?
On Mon, 4 Mar 2013, Krzysztof wrote: I'm stopping by: sudo service my_script.sh stop. Yes, but what signal does that send: SIGTERM probably -> this is a ShutDown. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Daemon - OnStop and OnDestroy events never fired?
I'm stopping by: sudo service my_script.sh stop. Ok so I just use shutdown event instead ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] warning: link.res contains output sections; did you forget -T?
On Mon, 4 Mar 2013 14:35:50 +0200 Juha Manninen wrote: > Yes, I know this warning can be ignored, and every active member of > this list knows it, too. > However new users don't know it. Everybody who tries FPC / Lazarus for > the first time will scratch their heads and use Google, trying to find > out where exactly they forgot to put this "-T". > > My workmate decided to try Lazarus after I had advertised it. > This was the first thing that he, too, noticed and reported to me. > Yes, Google gives links like: > http://www.lazarus.freepascal.org/index.php?topic=13500.0 > which finally clarify the situation. > Still, is there really no way to get rid of this warning? > I understand it comes from "ld". Is patching "ld" the only way? Patching? The error is simple: can not find the library. ld can not tell much more, except maybe where it has searched, and what .o file or link.res has asked for the library. Maybe a quickfix item can be added to extend the message with that information. Just like the IDE is doing for "can not find unit" messages. It can not give the information how to install the needed library, because there are too many possibilities. Maybe a link to a page about linker errors with some explanations and examples can be given. Or the lpk could provide a fpdoc topic about link errors and the IDE could automatically show that. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Daemon - OnStop and OnDestroy events never fired?
On Mon, 4 Mar 2013, Krzysztof wrote: Hi, I have daemon on Linux Mint 14 64bit which working fine, but I noticed that OnStop and OnDestroy events are never fired. I created simple test which write to syslog and create file in my home directory: How do you stop the service ? Stop has no meaning on Linux; only shutdown. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Daemon - OnStop and OnDestroy events never fired?
Hi, I have daemon on Linux Mint 14 64bit which working fine, but I noticed that OnStop and OnDestroy events are never fired. I created simple test which write to syslog and create file in my home directory: procedure TTestDaemon.DataModuleStop(Sender: TCustomDaemon; var OK: Boolean); var sl: TStringList; begin sl := TStringList.Create; try sl.Add('test'); sl.SaveToFile('/home/dibo/s.txt'); finally sl.Free; end; Application.Log(etInfo, 'Stopping'); end; procedure TTestDaemon.DataModuleDestroy(Sender: TObject); var sl: TStringList; begin sl := TStringList.Create; try sl.Add('test'); sl.SaveToFile('/home/dibo/d.txt'); finally sl.Free; end; Application.Log(etInfo, 'destroying'); end; But these event doesn't add logs in syslog, text file in home directory isn't created also. Is linux blocking disk writting when stopping service? There is also OnShutDown event which is working fine (I finally moved my "clean" methods to this event) but I'm wondering why mentioned events are not fired? Regards ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] warning: link.res contains output sections; did you forget -T?
Am 04.03.2013 13:35, schrieb Juha Manninen: Yes, I know this warning can be ignored, and every active member of this list knows it, too. However new users don't know it. Everybody who tries FPC / Lazarus for the first time will scratch their heads and use Google, trying to find out where exactly they forgot to put this "-T". My workmate decided to try Lazarus after I had advertised it. This was the first thing that he, too, noticed and reported to me. Yes, Google gives links like: http://www.lazarus.freepascal.org/index.php?topic=13500.0 which finally clarify the situation. Still, is there really no way to get rid of this warning? I understand it comes from "ld". Is patching "ld" the only way? No, this can't be changed without patching ld. Though you could try the new internal ELF linker on systems that already support it (AFAIK i386, x86_64 and MIPS (and maybe also ARM)), but I don't know whether it already supports all features (like building shared libraries). Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] warning: link.res contains output sections; did you forget -T?
Yes, I know this warning can be ignored, and every active member of this list knows it, too. However new users don't know it. Everybody who tries FPC / Lazarus for the first time will scratch their heads and use Google, trying to find out where exactly they forgot to put this "-T". My workmate decided to try Lazarus after I had advertised it. This was the first thing that he, too, noticed and reported to me. Yes, Google gives links like: http://www.lazarus.freepascal.org/index.php?topic=13500.0 which finally clarify the situation. Still, is there really no way to get rid of this warning? I understand it comes from "ld". Is patching "ld" the only way? Regards, Juha P.S. The big executable size was the second thing he noticed but that is another issue. We can improve that later with default buid modes in Lazarus. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Re: Bootstrap binaries
On 4-3-2013 10:48, Reinier Olislagers wrote: > On 4-3-2013 10:19, Marco van de Voort wrote: >> It's mainly a facility for source based package systems like the *bsd ports, >> where the enduser routinely bootstraps compiler + source too. >> (if that is sane, is a different question, specially in FPC's case which >> won't >> reuse global CFLAGS, but tradition...) >> >> That's why you see all BSD binaries uploaded, and other majority platforms >> are missing. >> >> Win32/64 in particular is useless, since there you need the binutils in the >> release package anyway. > > Well, Ludo Brands and I *did* build a tool that gets the binutils[1] if > they're not there and proceeds to build fpc+Lazarus afer svn checkout > for Linux and Windows (and perhaps it still works on OSX, haven't tested > for a long while). > > I would be *very* happy with the win32 and 64 builds. ... of the bootstrap compilers of course. Likewise for Linux x64 and x86. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Re: Bootstrap binaries
On 4-3-2013 10:19, Marco van de Voort wrote: > In our previous episode, Joao Morais said: >> How ftp://ftp.freepascal.org/pub/fpc/dist/2.6.2/bootstrap >> like lists are built? I missed at least i386-linux and i386-win32 >> binaries. > > They are simply the compiler binary extracted from the release in a bzipped > format. > > It's mainly a facility for source based package systems like the *bsd ports, > where the enduser routinely bootstraps compiler + source too. > (if that is sane, is a different question, specially in FPC's case which won't > reuse global CFLAGS, but tradition...) > > That's why you see all BSD binaries uploaded, and other majority platforms > are missing. > > Win32/64 in particular is useless, since there you need the binutils in the > release package anyway. Well, Ludo Brands and I *did* build a tool that gets the binutils[1] if they're not there and proceeds to build fpc+Lazarus afer svn checkout for Linux and Windows (and perhaps it still works on OSX, haven't tested for a long while). I would be *very* happy with the win32 and 64 builds. [1] and an svn executable on Windows etc... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Bootstrap binaries
In our previous episode, Joao Morais said: > How ftp://ftp.freepascal.org/pub/fpc/dist/2.6.2/bootstrap > like lists are built? I missed at least i386-linux and i386-win32 > binaries. They are simply the compiler binary extracted from the release in a bzipped format. It's mainly a facility for source based package systems like the *bsd ports, where the enduser routinely bootstraps compiler + source too. (if that is sane, is a different question, specially in FPC's case which won't reuse global CFLAGS, but tradition...) That's why you see all BSD binaries uploaded, and other majority platforms are missing. Win32/64 in particular is useless, since there you need the binutils in the release package anyway. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Bootstrap binaries
Am 04.03.2013 09:38 schrieb "Andreas Schneider" : > > On Monday, March 4, 2013, at 01:59 Joao Morais wrote: > > Hello list. How ftp://ftp.freepascal.org/pub/fpc/dist/2.6.2/bootstrap > > like lists are built? I missed at least i386-linux and i386-win32 > > binaries. Just to know how I will update my drafts. > > > Joao Morais > > > I guess bootstrap isn't necessary when the full compiler is available. > Which it is for i386-linux and i386-win32 (see directory above). It should be available as one might want to compile trunk without having a prebuilt compiler installed. Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Bootstrap binaries
On Monday, March 4, 2013, at 01:59 Joao Morais wrote: > Hello list. How ftp://ftp.freepascal.org/pub/fpc/dist/2.6.2/bootstrap > like lists are built? I missed at least i386-linux and i386-win32 > binaries. Just to know how I will update my drafts. > Joao Morais I guess bootstrap isn't necessary when the full compiler is available. Which it is for i386-linux and i386-win32 (see directory above). -- Best Regards, Andreas pgp4Vt49BdRvj.pgp Description: PGP signature ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal