Re: [fpc-pascal] Free Pascal - Older Versions
First of all, thanks for Jonas and Sven for the fast answers. It's unfortunate that you can't provide older versions, but I understand the reasons exposed. Thanks for the suggestion, Sven, I'll check the errors I'm having and post them here for help. Best regards, On Thu, Oct 6, 2016 at 3:14 PM Sven Barthwrote: > Am 06.10.2016 17:04 schrieb "Luiz Gonzaga de Oliveira Neto" < > luiz.g.oliveira.n...@gmail.com>: > > Thanks in advance for any help! > > As Jonas said we can't provide you with any older compiler, but if you'd > tell us what kind of errors you have maybe we can help you. Perhaps it's > merely something were you use the wrong compiler options. > > Regards, > Sven > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal -- -- Luiz G. de Oliveira Neto -- Unicamp - EC09 --- ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Free Pascal - Older Versions
Am 06.10.2016 17:04 schrieb "Luiz Gonzaga de Oliveira Neto" < luiz.g.oliveira.n...@gmail.com>: > Thanks in advance for any help! As Jonas said we can't provide you with any older compiler, but if you'd tell us what kind of errors you have maybe we can help you. Perhaps it's merely something were you use the wrong compiler options. Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] test plz ignore
plz ignore -- Dimitrios Chr Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] A serious Memleak using delegates/implements (was: Delegate Interface class does not seem to be referenced counted)
Hi Graeme, On Thu, Oct 6, 2016 at 12:05 PM, Graeme Geldenhuyswrote: > Hello Marcos, > > On 2016-10-06 at 11:41, Marcos Douglas wrote: > >> The COM and CORBA names, are both wrong. >> When you say COM, everybody thinks on Windows... that sad. > > > Yes, both names are horribly inaccurate. Unfortunately I don't see FPC > developers rectifying that any time soon. :-/ +1 Unfortunately. Marcos Douglas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] A serious Memleak using delegates/implements (was: Delegate Interface class does not seem to be referenced counted)
On Thu, Oct 6, 2016 at 11:57 AM, Graeme Geldenhuyswrote: > Hello Marcos, > > On 2016-10-06 at 11:25, Marcos Douglas wrote: > >> you need to declarate >> two variables to do one job. >> I don't like that and I think shouldn't be necessary. > > Well, to be fair, that example is not representative of a real-world > application. In a real-world app, I would not declare and release > objects and interface references like than - in the same procedure. Yes of course, I know. You will do some like that: constructor TFoo.Create; begin FTheObject := TBar.Create; // implements ITheObject end; destructor TFoo.Destroy; begin FTheObject.Free; end; procedure TFoo.Execute; begin CallSomethingThatAcceptsAnInterface(FTheObject); end; Nothing wrong. But you needs to create TFoo and manage it. Regards, Marcos Douglas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Free Pascal - Older Versions
Luiz Gonzaga de Oliveira Neto wrote: > I've found some older versions in this > link: http://www.freepascal.org/down/old/down.var. But, for Win32, the > oldest version I've found was the 2.2.2. Is this the oldest version for > Win32? Is there a place where I could access even older versions of the > compiler? No, sorry. We had to remove access to them because in the early days, some people appear to have copy/pasted code from the Delphi RTL into the FPC RTL, which is obviously unacceptable and which constituted copyright infringement. Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] A serious Memleak using delegates/implements (was: Delegate Interface class does not seem to be referenced counted)
Hello Marcos, On 2016-10-06 at 11:41, Marcos Douglas wrote: > The COM and CORBA names, are both wrong. > When you say COM, everybody thinks on Windows... that sad. Yes, both names are horribly inaccurate. Unfortunately I don't see FPC developers rectifying that any time soon. :-/ Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Free Pascal - Older Versions
Hello all, My name is Luiz and I'm a Masters student at Brazil. This is my first e-mail in this list. In my Masters research, I've acquired from the author some codes in Pascal, a language I've never worked with. I need to make some small modifications to the code and recompile it, but I'm not having success with the latest version of Free Pascal, the compiler recommended by the author. I've researched some of the errors that I have and I think there are some incompatibilities with changes added to newer versions of Free Pascal. Since I never worked with Pascal, I would rather change the original code the least I can. So, I'd like to test older versions of the Free Pascal compiler and see if I can compile with them. I understand that older versions are not supported and it's always better to use the latest version, but I have evidence that lead me to believe that the code is "right", but inconsistent with newer versions, and I think the correct path would be to first try to compile it with older versions of FPC before changing it and trying to make it compile with the latest one. I've found some older versions in this link: http://www.freepascal.org/down/old/down.var. But, for Win32, the oldest version I've found was the 2.2.2. Is this the oldest version for Win32? Is there a place where I could access even older versions of the compiler? This would really help my research to move forward! Thanks in advance for any help! Best regards, -- -- Luiz G. de Oliveira Neto -- Unicamp - EC09 --- ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] A serious Memleak using delegates/implements (was: Delegate Interface class does not seem to be referenced counted)
Hello Marcos, On 2016-10-06 at 11:25, Marcos Douglas wrote: > you need to declarate > two variables to do one job. > I don't like that and I think shouldn't be necessary. Well, to be fair, that example is not representative of a real-world application. In a real-world app, I would not declare and release objects and interface references like than - in the same procedure. Regards, - Graeme - fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] A serious Memleak using delegates/implements (was: Delegate Interface class does not seem to be referenced counted)
On Thu, Oct 6, 2016 at 7:36 AM, Graeme Geldenhuyswrote: > On 2016-10-06 02:49, Marcos Douglas wrote: >> I understand you, but reference counting help us to write a better >> code, more object-oriented. > > That's got nothing to do with reference counting functionality. I use > object-oriented coding practices all the time, but I don't need > reference counting for that. OOP, for me, It is closer to functional programming. You should to code more declarative and less imperative. Declare a variable; Create; try-finally; using line-by-line; call Free... that is imperative, Procedural and not about OOP. >> I'm using decorator pattern. No problem with it, but delegates makes >> me write less code and the design is awesome. > > So, nothing stops you from using interface delegates with CORBA style > interfaces. See the example code I just posted, where I converted the > original example to use CORBA style interfaces instead. I saw. But I can't use like that, as I explained above. Sorry... but thanks. > I'm a huge believer and user of design patterns, and most of them I've > implemented using Interfaces. Nothing there tells me I must use COM > style interfaces. The COM and CORBA names, are both wrong. When you say COM, everybody thinks on Windows... that sad. IMHO, interfaces with reference-counting is useful to write better code, less imperative and using a design more closer to functional. Best regards, Marcos Douglas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] A serious Memleak using delegates/implements (was: Delegate Interface class does not seem to be referenced counted)
On Thu, Oct 6, 2016 at 7:30 AM, Graeme Geldenhuyswrote: > On 2016-10-05 16:26, Marcos Douglas wrote: >> So, I coded a new example — more simpler, I think — to demonstrate the same >> problem and prove that there is some wrong that is causing a memleak. > > And here is that example converted to use CORBA style interfaces and no > memory leaks. I've used CORBA before... but see your example, you need to declarate two variables to do one job. I don't like that and I think shouldn't be necessary. Marcos Douglas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] A serious Memleak using delegates/implements (was: Delegate Interface class does not seem to be referenced counted)
On Thu, Oct 6, 2016 at 7:11 AM, Graeme Geldenhuyswrote: > On 2016-10-06 02:34, Marcos Douglas wrote: >> But, the result was the same, even using D7. >> So, is this by design? Sad... > > Sad and nasty indeed. But it seems it is “by design” or done for “Delphi > compatibility”. > > It would be interesting to know what Delphi developers think of this. > You should post the new code example and message to a Delphi newsgroup > or Google+ forum and see what they think of that. If it has been around > since the D7 days (and maybe even earlier), they might have an > explanation or work-around for you. That's a good idea. I'll do it. Marcos Douglas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] A serious Memleak using delegates/implements (was: Delegate Interface class does not seem to be referenced counted)
On 06/10/16 11:08, Graeme Geldenhuys wrote: I've seem some COM Interface code where they had to resort to using raw Pointer types etc to try and avoid reference counting and causing unexpected memory leaks. I have also seen plenty of examples of poor coding with classes, but the fact that someone writes bad object oriented programs doesn't mean that object oriented is a poor programming technique. Likewise, poor programming using com interfaces doesn't invalidate the use of com interfaces. When you work with interfaces, there are two issues to consider: 1. How easy is the interface to use 2. How do you write the underlying classes. To me, the first rules out delegated interfaces and COM. Even advanced level programmers will get it wrong and you will never get an easy to use interface with this combination. It looks like a design error that came from Delphi and was copied by FPC. However, if you rule out this combination, COM does make for what seems to be a very intuitive easy to use interface, in the same way that AnsiStrings are easy to use. On the other hand, implementing the classes that provide a com interface does require some skill and is not for everyone. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] A serious Memleak using delegates/implements (was: Delegate Interface class does not seem to be referenced counted)
On 2016-10-06 02:49, Marcos Douglas wrote: > I understand you, but reference counting help us to write a better > code, more object-oriented. That's got nothing to do with reference counting functionality. I use object-oriented coding practices all the time, but I don't need reference counting for that. > I'm using decorator pattern. No problem with it, but delegates makes > me write less code and the design is awesome. So, nothing stops you from using interface delegates with CORBA style interfaces. See the example code I just posted, where I converted the original example to use CORBA style interfaces instead. I'm a huge believer and user of design patterns, and most of them I've implemented using Interfaces. Nothing there tells me I must use COM style interfaces. > For me, it's a bug. Sorry. That I agree with. There seems to be a COM reference counted bug. Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] A serious Memleak using delegates/implements (was: Delegate Interface class does not seem to be referenced counted)
On 2016-10-05 16:26, Marcos Douglas wrote: > So, I coded a new example — more simpler, I think — to demonstrate the same > problem and prove that there is some wrong that is causing a memleak. And here is that example converted to use CORBA style interfaces and no memory leaks. Program output: == [tmp]$ ./test.exe IntegerValue: TIntegerValue.Create Number is 5 TIntegerValue.Destroy MyApp: TIntegerValue.Create TMyApp.Create Number is 10 TIntegerValue.Destroy TMyApp.Destroy MyAppAsInterface: TIntegerValue.Create TMyApp.Create Number is 20 TIntegerValue.Destroy TMyApp.Destroy Heap dump by heaptrc unit 29 memory blocks allocated : 2045/2080 29 memory blocks freed : 2045/2080 0 unfreed memory blocks : 0 True heap size : 1409024 (32 used in System startup) True free heap : 1408992 == Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp program Project1; {$mode objfpc}{$H+} {$interfaces corba} uses Classes, SysUtils; type IValue = interface ['{C3151460-CA9B-447A-A7E8-86399222E844}'] function AsString: string; end; TIntegerValue = class(TObject, IValue) private FValue: Integer; public constructor Create(Value: Integer); destructor Destroy; override; function AsString: string; end; TMyApp = class(TObject, IValue) private FValue: TIntegerValue; function GetValue: IValue; // this interface property doesn't need to be public property Value: IValue read GetValue implements IValue; public constructor Create(AValue: Integer); destructor Destroy; override; end; { TIntegerValue } constructor TIntegerValue.Create(Value: Integer); begin inherited Create; FValue := Value; WriteLn('TIntegerValue.Create'); end; destructor TIntegerValue.Destroy; begin WriteLn('TIntegerValue.Destroy'); inherited Destroy; end; function TIntegerValue.AsString: string; begin Result := 'Number is ' + IntToStr(FValue); end; { TMyApp } function TMyApp.GetValue: IValue; begin Result := FValue; end; constructor TMyApp.Create(AValue: Integer); begin inherited Create; FValue := TIntegerValue.Create(AValue); WriteLn('TMyApp.Create'); end; destructor TMyApp.Destroy; begin FValue.Free; WriteLn('TMyApp.Destroy'); inherited Destroy; end; // Program procedure ExecuteIntegerValue; var i: TIntegerValue; V: IValue; begin WriteLn; WriteLn('IntegerValue:'); i := TIntegerValue.Create(5); V := i; WriteLn(V.AsString); i.Free; end; procedure ExecuteMyApp; var App: TMyApp; begin WriteLn; WriteLn('MyApp:'); App := TMyApp.Create(10); try WriteLn(App.Value.AsString); finally App.Free; end; end; procedure ExecuteMyAppAsInterface; var app: TMyApp; V: IValue; begin WriteLn; WriteLn('MyAppAsInterface:'); try app := TMyApp.Create(20); V := app; WriteLn(V.AsString); finally app.Free; end; end; begin ExecuteIntegerValue; ExecuteMyApp; ExecuteMyAppAsInterface; ReadLn; end. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] A serious Memleak using delegates/implements (was: Delegate Interface class does not seem to be referenced counted)
On 2016-10-06 02:34, Marcos Douglas wrote: > But, the result was the same, even using D7. > So, is this by design? Sad... Sad and nasty indeed. But it seems it is “by design” or done for “Delphi compatibility”. It would be interesting to know what Delphi developers think of this. You should post the new code example and message to a Delphi newsgroup or Google+ forum and see what they think of that. If it has been around since the D7 days (and maybe even earlier), they might have an explanation or work-around for you. Regards, Graeme ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] A serious Memleak using delegates/implements (was: Delegate Interface class does not seem to be referenced counted)
On 2016-10-05 23:16, Tony Whyman wrote: > Used properly reference counted interfaces are very powerful and allow > for some very elegant programming. Do you complain about AnsiStrings? I have very powerful and elegant programming with CORBA interfaces too. ;-) Also as Martin mentioned, reference counting works wonders in simple cases, but gets very nasty in medium to complex cases. I've seem some COM Interface code where they had to resort to using raw Pointer types etc to try and avoid reference counting and causing unexpected memory leaks. No such problems with CORBA Interfaces. ps: You can obviously implement your own reference counted CORBA interface for the simple cases too. So you have the best of both worlds I guess, but when using CORBA Interfaces, I would avoid mixing reference counted and non-reference counted interfaces. Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] A serious Memleak using delegates/implements (was: Delegate Interface class does not seem to be referenced counted)
On 2016-10-06 05:54, Martin Schreiber wrote: > Recently I had to revive my stone old AMD-K6 PC with Windows 95. What marvel, > that relict with its age-old applications provides a better user experience, > is snappier, more convenient and more productive than my newest Linux machine > with the modern desktops and applications. We seem to have a lot in common. I still prefer Win2000 for any Windows development (if I must use Windows). Memory efficient and very snappy indeed! For Linux (actually FreeBSD) I long ago gave up on the extremely bloated 'desktop environments' and have for years been using JWM (Joe's Window Manager) - old school to the point, extremely fast and memory efficient (8MB max) window manager. JWM stays out of my way, has hardly any keyboard shortcuts to interfere with my daily programs, gives me a task bar, virtual desktops and a popup menu. I don't need more than that. Oh, and I run this on a Intel i7 3.5Ghz CPU with 32GB RAM. I prefer to use my RAM for actual applications, VMs or the ZFS file system - not the desktop environment. ;-) Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Checking the validity of Format and friends at compile-time
El 05/10/2016 a las 19:47, Michalis Kamburelis escribió: > 2016-10-05 9:00 GMT+02:00 Maciej Izak: >> 2016-10-05 4:32 GMT+02:00 Michalis Kamburelis : >>> For example, the call >>> >>> Format('%s', [123]) >> >> I have a small hint (instead of answer). We have in mORMot / NewPascal in >> SynCommons module nice function which works perfect in most of cases: >> >> FormatUTF8('%', [123], []); // same string '%' works for both: integer and >> string values >> FormatUTF8('%', ['123'], []); >> > That's a cool improvement. No need to write the type, so one less > thing that can go wrong:) I seldom use non-standard formats anyway > (like %g instead of %f for floats). I don't agree. You are asking for a compile time check, but now you accept skipping run time type check doing a automatic type conversion. Things can go as wrong as with classic format but, without runtime error or exception, hunting bugs is more difficult. I support your first idea: Compile time check. I haven't understand very well whether Sven Barth's reluctance is a matter of taste or whether there are serious technical reasons. If there are not severe design drawbacks, I would go for it. I love compile time checks. The more, the better. -- Saludos Santiago A. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Checking the validity of Format and friends at compile-time
In our previous episode, Michael Schnell said: > > RTL not to mention that user code that uses "array of const" wouldn't > > necessarily benefit from it. > GNU C does check this when using printf() and friends, and rather > obviously the "array of const" is modeled after the C ellipse notation. But array of const is safe, and C's isn't, which is why C compilers routinely check it. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Checking the validity of Format and friends at compile-time
On 05.10.2016 07:59, Sven Barth wrote: something like this definitely wouldn't become part of the compiler as that would mean an unnecessarily tight coupling between compiler and RTL not to mention that user code that uses "array of const" wouldn't necessarily benefit from it. GNU C does check this when using printf() and friends, and rather obviously the "array of const" is modeled after the C ellipse notation. -Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal