Re: [fpc-pascal] pchar with more than 255 characters

2011-11-14 Thread Felipe Monteiro de Carvalho
On Sun, Nov 13, 2011 at 1:39 AM, Rainer Stratmann wrote: > procedure getchars( p : pchar ); > var l : longint; > begin >  l := length( p ); > end; You cannot do length in a PChar, it has no length information. I think this code is probably automatically converting the PChar to a Pascal String and

Re: [fpc-pascal] parent class as a parameter type

2011-11-14 Thread Jonas Maebe
On 13 Nov 2011, at 17:56, Graeme Geldenhuys wrote: > On 12/11/2011, ik wrote: >> >> procedure foo(AClass : TStrings); >> foo(MyStringList); // Will return an error that TStrings is expected ... >> >> I can not use TStringList as the parameter without casting it to TStrings. >> But I do not und

Re: [fpc-pascal] Re: pchar with more than 255 characters

2011-11-14 Thread Jonas Maebe
On 13 Nov 2011, at 14:02, Rainer Stratmann wrote: > Am Sunday 13 November 2011 02:15:07 schrieb leledumbo: >> It works when {$LONGSTRINGS ON} or {$H+} directive exists. I think the >> compiler treats functions receiving array of char (or pointer to it) as >> ShortString when none of the directive

Re: [fpc-pascal] parent class as a parameter type

2011-11-14 Thread Felipe Monteiro de Carvalho
On Sun, Nov 13, 2011 at 5:56 PM, Graeme Geldenhuys wrote: > Luckily I could change my code to TStringList to work around the > problem. One can type-cast to get around the issue, so then method declarations don't need to be changed: foo(TStrings(MyStringList)); -- Felipe Monteiro de Carvalho

[fpc-pascal] Makeskel error or error behind keyboard?

2011-11-14 Thread Reinier Olislagers
Hi list, Trying to start documenting fpXMLXSDExport: c:\development\fpc\bin\i386-win32\makeskel --disable-private --emit-class-separator --update --package=fcl --input=C:\development\Fpc\Source\packages\fcl-db\src\export\fpxmlxsdexport.pp --output=fpxmlxsdexport.xml MakeSkel - FPDoc skeleton XML d

[fpc-pascal] [OT] AI programming challenge includes FreePascal

2011-11-14 Thread Reinier Olislagers
Hi all, In case you didn't know and are interested, there is an online artificial intelligence competition [1] that lets you program an ant colony that fights other colonies. There's a FreePascal starter kit available as well. You can test your program against others now; your submission needs t

[fpc-pascal] CloseThread needed? still unclear

2011-11-14 Thread noreply
While testing an updated version of nYume (aservia) I found that the program is leaking thread handles on Ms Windows. The program uses BeginThread and EndThread calls. However, when I add CloseThread() right before EndThread(, the program no longer leaks handles. So, CloseThread may be needed on M

Re: [fpc-pascal] parent class as a parameter type

2011-11-14 Thread Jonas Maebe
On 12 Nov 2011, at 22:18, ik wrote: > Since 2.6.0, when you write something like this: > > procedure foo(AClass : TStrings); > foo(MyStringList); // Will return an error that TStrings is expected ... Are you certain there is no "var" or "out" in front of that parameter? > I can not use TString

Re: [fpc-pascal] parent class as a parameter type

2011-11-14 Thread cobines
Works for me: program a; {$mode objfpc}{$H+} uses Classes; procedure foo(AClass: TStrings); begin end; var sl: TStringList; begin foo(sl); end. -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org

Re: [fpc-pascal] parent class as a parameter type

2011-11-14 Thread Graeme Geldenhuys
On 12/11/2011, ik wrote: > > Since 2.6.0, when you write something like this: I think it was even before this. > procedure foo(AClass : TStrings); > foo(MyStringList); // Will return an error that TStrings is expected ... > > I can not use TStringList as the parameter without casting it to TStri

Re: [fpc-pascal] Re: pchar with more than 255 characters

2011-11-14 Thread Graeme Geldenhuys
On 13/11/2011, leledumbo wrote: > I think the > compiler treats functions receiving array of char (or pointer to it) as > ShortString when none of the directives above exist. Indeed, FPC defaults to ShortString if {$H+} is not specified. That is probably the problem. I really don't know why this

Re: [fpc-pascal] Compilation time

2011-11-14 Thread Graeme Geldenhuys
On 12/11/2011, Florian Klämpfl wrote: > Am 12.11.2011 21:51, schrieb Rainer Stratmann: >> Does more cpu cores mean less compile time? > > No. Doing a 'make' for the FPC project, multiple cores can be used (via eg: -j 5 command line parameter on a quad core system). But I think the multi-core is o

Re: [fpc-pascal] parent class as a parameter type

2011-11-14 Thread Sven Barth
On 12.11.2011 22:18, ik wrote: Since 2.6.0, when you write something like this: procedure foo(AClass : TStrings); foo(MyStringList); // Will return an error that TStrings is expected ... I can not use TStringList as the parameter without casting it to TStrings. But I do not understand why this

Re: [fpc-pascal] Re: pchar with more than 255 characters

2011-11-14 Thread Rainer Stratmann
Am Sunday 13 November 2011 02:15:07 schrieb leledumbo: > It works when {$LONGSTRINGS ON} or {$H+} directive exists. I think the > compiler treats functions receiving array of char (or pointer to it) as > ShortString when none of the directives above exist. No it does not work then. I put already t

[fpc-pascal] (no subject)

2011-11-14 Thread sider2jp
___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal