Re: [fpc-pascal] about "reference-counted" variables

2013-03-13 Thread Sven Barth
Am 14.03.2013 02:54 schrieb "Xiangrong Fang" : > > Is there a "complete" list of reference counted variables in FP? e.g. dynamic arrays are ref-counted. but are variables allocated by New() ref-counted? Dynamic arrays AnsiString UnicodeString (and on non Windows also WideString) COM style interfa

[fpc-pascal] about "reference-counted" variables

2013-03-13 Thread Xiangrong Fang
Is there a "complete" list of reference counted variables in FP? e.g. dynamic arrays are ref-counted. but are variables allocated by New() ref-counted? My use case is: type PMyRecord = ^TMyRecord; p: = New(PMyRecord); MyListView.Item[0].Data = p; MyListView.Item[0].Delete; <-- Do I need t

Re: [fpc-pascal] Re: Selective Class Helper

2013-03-13 Thread Xiangrong Fang
I vote for Traits. This will make FP more flexible... As a matter of fact, I was surprised to see operator overloading being implemented in pascal, which was a feature I like in C++, although I have never write a program more complex than cout << "Hello World" in that magnificent language. :-) 2

Re: [fpc-pascal] catch segfaults

2013-03-13 Thread Xiangrong Fang
The document said it is "deprecated"? Also, I want this to be cross platform, not for unix only. The use case is: try buf := GetMemory(1024); size := 10240; stream.Read(buf^, size); except ?? end; 2013/3/14 Ewald > Once upon a time, Xiangrong Fang said: > > Is it possible to use try...

Re: [fpc-pascal] catch segfaults

2013-03-13 Thread Ewald
Once upon a time, Xiangrong Fang said: > Is it possible to use try...except to catch SIGSEGV? I don't know if it is possible, but how about using fpSignal()? See http://www.freepascal.org/docs-html/rtl/baseunix/fpsignal.html -- Ewald ___ fpc-pascal mai

[fpc-pascal] catch segfaults

2013-03-13 Thread Xiangrong Fang
Is it possible to use try...except to catch SIGSEGV? Thanks! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Re: Selective Class Helper

2013-03-13 Thread Sven Barth
Am 13.03.2013 17:04 schrieb "leledumbo" : > > That would change the class model to prototyping (as in Lua, JavaScript, > etc.), which is not how it's implemented in Object Pascal... I would more call it "Traits" which is at least a feature I'd like to research. This means that I'll implement it in

Re: [fpc-pascal] differences between .pp and .pas files

2013-03-13 Thread Graeme Geldenhuys
On 2013-02-25 05:34, Eric Kom wrote: > > Please what is a difference between .pp and .pas files extension? > And what is interesting, is that FP Text IDE (which looks like Turbo Pascal IDE) defaults to the .pas extension when creating new units. You would think being so closely related to Free

Re: [fpc-pascal] Randomly project fails to link under FreeBSD

2013-03-13 Thread Graeme Geldenhuys
On 2013-03-11 17:32, Graeme Geldenhuys wrote: > > Anyway, every now and again my projects (a few of them) fail to link as > follows Problem solved! I had a program unit named m2compiler.lpr, and in another directory I had a unit named M2Compiler.pas. This caused the conflict at linking. Simply c

[fpc-pascal] Re: Selective Class Helper

2013-03-13 Thread leledumbo
That would change the class model to prototyping (as in Lua, JavaScript, etc.), which is not how it's implemented in Object Pascal... -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Selective-Class-Helper-tp5713531p5713545.html Sent from the Free Pascal - Gener

Re: [fpc-pascal] differences between .pp and .pas files

2013-03-13 Thread Zaher Dirkey
I am using "pas" for units that Delphi compatible you can compile it with Delphi, now "pp" it is only FPC compiled not compatible with Delphi. On Mon, Feb 25, 2013 at 7:34 AM, Eric Kom wrote: > Good day, > > Please what is a difference between .pp and .pas files extension? > > -- > Kind Regards

Re: [fpc-pascal] two questions about dynamic array

2013-03-13 Thread Sven Barth
Am 13.03.2013 10:53 schrieb "Xiangrong Fang" : > > 2013/3/13 Sven Barth >> >> Am 13.03.2013 10:08 schrieb "Xiangrong Fang" : >> > 2) After SetLength(myarray, 0), is myarray nil or pointing to some invalid address? >> >> It will be Nil. An equivalent alternative would be: >> >> MyArray := Nil; > >

Re: [fpc-pascal] Re: two questions about dynamic array

2013-03-13 Thread Sven Barth
Am 13.03.2013 10:45 schrieb "Xiangrong Fang" : >> >> Yes, in that case it will be Nil (Note: in the static case the elements of the array would be 0). > > > So, it is even OK to use SetLength() on static arrays? interesting. No, I meant that the content of a static array will be initialized to zer

[fpc-pascal] FPC / Lazarus ARM Embedded Debuging

2013-03-13 Thread Justin Smyth
Sorry of this cross posts but i wasn't sure where to send this question to. I am currently using a LPC 1343 Microprocessor board and i have recently purchased a ULINK2 debugging kit from china. i am aware that there are plans to allow debugging these boards using the UNLINK2, but it wasnt som

Re: [fpc-pascal] fpweb: processing URLs like GET http://server/cgi-bin/tigercgi/documents/301/

2013-03-13 Thread Reinier Olislagers
On 25-2-2013 13:38, Michael Van Canneyt wrote: > On Mon, 25 Feb 2013, Reinier Olislagers wrote: > As soon as the path has more than 1 component, it is assumed that the > path is composed of > /module/action/whatever. > If - and only if - there is only 1 path component, it is assumed to be > an acti

Re: [fpc-pascal] Re: two questions about dynamic array

2013-03-13 Thread Howard Page-Clark
On 13/03/13 9:50, Mattias Gaertner wrote: On Wed, 13 Mar 2013 09:35:43 + Howard Page-Clark wrote: On 12/03/13 8:30, Xiangrong Fang wrote: TMyClass = class myarray: array[0..100] of Integer; end; You could answer such questions yourself: Not with this simple test. [...] my:

Re: [fpc-pascal] two questions about dynamic array

2013-03-13 Thread Xiangrong Fang
2013/3/13 Sven Barth > Am 13.03.2013 10:08 schrieb "Xiangrong Fang" : > > 2) After SetLength(myarray, 0), is myarray nil or pointing to some > invalid address? > > It will be Nil. An equivalent alternative would be: > > MyArray := Nil; > Sorry, I didn't see this reply just now... You mean, by

Re: [fpc-pascal] Re: two questions about dynamic array

2013-03-13 Thread Mattias Gaertner
On Wed, 13 Mar 2013 09:35:43 + Howard Page-Clark wrote: > On 12/03/13 8:30, Xiangrong Fang wrote: > > TMyClass = class > > myarray: array[0..100] of Integer; > > end; > You could answer such questions yourself: Not with this simple test. >[...] >my:=TMyClass.Create; >try >

Re: [fpc-pascal] Re: two questions about dynamic array

2013-03-13 Thread Xiangrong Fang
> > Yes, in that case it will be Nil (Note: in the static case the elements of > the array would be 0). > So, it is even OK to use SetLength() on static arrays? interesting. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepas

Re: [fpc-pascal] Selective Class Helper

2013-03-13 Thread Sven Barth
Am 13.03.2013 10:09 schrieb "Xiangrong Fang" : > > Hi There, > > Is it possible for class helpers to be "selective"? i.e. attach to a specific object of that class, but not every instance? This would be useful for "behavior injection". No, this is not possible. Regards, Sven __

Re: [fpc-pascal] two questions about dynamic array

2013-03-13 Thread Sven Barth
Am 13.03.2013 10:08 schrieb "Xiangrong Fang" : > 2) After SetLength(myarray, 0), is myarray nil or pointing to some invalid address? It will be Nil. An equivalent alternative would be: MyArray := Nil; Regards, Sven ___ fpc-pascal maillist - fpc-pasca

Re: [fpc-pascal] Re: two questions about dynamic array

2013-03-13 Thread Sven Barth
Am 13.03.2013 10:08 schrieb "Xiangrong Fang" : > > Sorry the array should be dynamic, without [0..100]. > > Yes, in that case it will be Nil (Note: in the static case the elements of the array would be 0). Regards, Sven ___ fpc-pascal maillist - fpc-p

Re: [fpc-pascal] Re: two questions about dynamic array

2013-03-13 Thread Howard Page-Clark
On 12/03/13 8:30, Xiangrong Fang wrote: TMyClass = class myarray: array[0..100] of Integer; end; You could answer such questions yourself: program Project1; {$mode objfpc} type TMyClass = class myarray: array of Integer; end; var my:TMyClass; begin my:=TMyClass.Create; try wri

[fpc-pascal] Selective Class Helper

2013-03-13 Thread Xiangrong Fang
Hi There, Is it possible for class helpers to be "selective"? i.e. attach to a specific object of that class, but not every instance? This would be useful for "behavior injection". Thanks ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org ht

[fpc-pascal] Re: two questions about dynamic array

2013-03-13 Thread Xiangrong Fang
Sorry the array should be dynamic, without [0..100]. 2013/3/12 Xiangrong Fang > Hi All, > > I have two simple questions: > > 1) As far as I know class variables in FPC are automatic initialize to the > NULL value (e.g. 0 or "" or whatever), does that include dynamic arrays? > e.g. > > TMyClass =

[fpc-pascal] two questions about dynamic array

2013-03-13 Thread Xiangrong Fang
Hi All, I have two simple questions: 1) As far as I know class variables in FPC are automatic initialize to the NULL value (e.g. 0 or "" or whatever), does that include dynamic arrays? e.g. TMyClass = class myarray: array[0..100] of Integer; end; will myarray be initialized to nil? 2) Aft

[fpc-pascal] Randomly project fails to link under FreeBSD

2013-03-13 Thread Graeme Geldenhuys
Hi, I'm using FPC 2.7.1 under 64-bit FreeBSD 9.1. I have to use 2.7.1 (updated about a week ago), so I could get the fixes for threading and memory corruption under FreeBSD (disussed a while back on mailing list). Anyway, every now and again my projects (a few of them) fail to link as follows --