Re: [fpc-pascal] Empty string

2008-03-06 Thread Flávio Etrusco
To the OP: are you using the AnsiString as a buffer (that contains "several" strings)? Otherwise, using "MyString <> '' " would do because #0 is only valid as terminator in UTF-8 too. BTW, IIRC Delphi would generate faster code for the above construction instead of "Length(MyString) <> 0" because

Re: [fpc-pascal] fpc 2.3.1 doesn't allow to pass literal constants as formal const parameter

2008-03-06 Thread Felipe Monteiro de Carvalho
On Wed, Mar 5, 2008 at 7:29 PM, Vincent Snijders <[EMAIL PROTECTED]> wrote: > Currently fpc 2.3.1 cannot build lazarus anymore. It fails on lines like > MyStream.Write(' ',1); One idea to solve this in a good way might be: MyStream.Write(' ', SizeOf(Char)); or multiples of sizeof(char) for many

Re: [fpc-pascal] fpc 2.3.1 doesn't allow to pass literal constants as formal const parameter

2008-03-06 Thread Jonas Maebe
On 06 Mar 2008, at 22:22, Vincent Snijders wrote: Peter Vreman schreef: 1. It is passed by value and not by reference. The compile could decide to pass by reference, couldn't it. That's what it did in the past, but that's a hack (because it's passing a value without an address by refere

Re: [fpc-pascal] fpc 2.3.1 doesn't allow to pass literal constants as formal const parameter

2008-03-06 Thread Vincent Snijders
Peter Vreman schreef: Currently fpc 2.3.1 cannot build lazarus anymore. It fails on lines like MyStream.Write(' ',1); The write method is declared as function Write(const Buffer; Count: Longint): Longint Why isn't passing literal constant to a formal const parameter allowed anymore? I se

Re: [fpc-pascal] Re: assitent with Macro translation

2008-03-06 Thread Marco van de Voort
> Marco van de Voort wrote: > > > > You can't. This is more like trying to do generics with macro's on C level. > > And since FPC macro's afaik have no parameter syntax, this is not possible. > > > > > Hmm, what about (+/-): > > type_of_elts_entry(type_ptr(integer(ary.elts ) + i * > sizeof(typ

[fpc-pascal] Re: assitent with Macro translation

2008-03-06 Thread Milan Marusinec
Marco van de Voort wrote: I've started binding libsvn to FPC, and I have encountered the following macro that I do not know how to translate: #define APR_ARRAY_IDX(ary,i,type) (((type *)(ary)->elts)[i]) The usage of such macro is as follows: APR_ARRAY_IDX (new_entries, i, const char *); How ca

Re: [fpc-pascal] Empty string

2008-03-06 Thread Gene Buckle
I thought string should be accessed from 1 not 0 for compatibility. And it is what I am doing. for i := 1 to length(s) do ... so I am not sure that using s[0] is safe If memory serves, the [0] element was originally used to hold a byte that was equivalent to the string length. This was in t

Re: [fpc-pascal] Empty string

2008-03-06 Thread Damien Gerard
Le Mar 6, 2008 à 5:26 PM, Lucas Vasconcelos a écrit : You can try access a UTF8String lika a array. So, you can replace your test by if mystringvar[0] <> '' then ... I thought string should be accessed from 1 not 0 for compatibility. And it is what I am doing. for i := 1 to length(s) do

Re: [fpc-pascal] Re: WSAGetLastError returns 0 when it shouldn't but I cannot see why

2008-03-06 Thread Luca Olivetti
El Thu, 06 Mar 2008 13:09:34 +0100 "Lukas Gebauer" <[EMAIL PROTECTED]> escribió: > It is IMHO bug in FPC, just because Synapse code working in > Delphi/Kylix threads perfectly. It have a problem on FPC threads > only, and as I see in this discussion, problem have other programs > too, not just

Re: [fpc-pascal] Empty string

2008-03-06 Thread Lucas Vasconcelos
You can try access a UTF8String lika a array. So, you can replace your test by if mystringvar[0] <> '' then ... -- Lucas Vasconcelos ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] fpc 2.3.1 doesn't allow to pass literal constants as formal const parameter

2008-03-06 Thread Peter Vreman
> Currently fpc 2.3.1 cannot build lazarus anymore. It fails on lines like > MyStream.Write(' ',1); > > The write method is declared as >function Write(const Buffer; Count: Longint): Longint > > Why isn't passing literal constant to a formal const parameter allowed > anymore? 1. It is passed b

Re: [fpc-pascal] Re: WSAGetLastError returns 0 when it shouldn't but I cannot see why

2008-03-06 Thread Lukas Gebauer
> Changing my "procedure PError(msg:string)" to "procedure PError(const > msg:string)" in TSocketThread.Execute in project2 also fixes the > problem. This smells like a bug somewhere in fpc/rtl, since I don't > think it should make a difference. Anyway, this gives me no clue on > how to "fix" synap

Re: [fpc-pascal] assitent with Macro translation

2008-03-06 Thread Marco van de Voort
> I've started binding libsvn to FPC, and I have encountered the > following macro that I do not know how to translate: > #define APR_ARRAY_IDX(ary,i,type) (((type *)(ary)->elts)[i]) > > The usage of such macro is as follows: APR_ARRAY_IDX (new_entries, i, > const char *); > > How can I translat

[fpc-pascal] assitent with Macro translation

2008-03-06 Thread ik
Hello, I've started binding libsvn to FPC, and I have encountered the following macro that I do not know how to translate: #define APR_ARRAY_IDX(ary,i,type) (((type *)(ary)->elts)[i]) The usage of such macro is as follows: APR_ARRAY_IDX (new_entries, i, const char *); How can I translate the "t