Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-02

Delphi5 -> Lazarus issues

5 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

Just recently I (Lazarus newcomer) converted a 4'500 lines tool for Finite Element mesh manipulations from Delphi 5 to Lazarus. 99.9% went extremely well (a big compliment to all contributers!), but 4 small differences made a little bit of headaches:
1. After finalisation of "For I:=B To E Do..." in Delphi is I=E+1, in Lazarus it is I=E. (I remember, that using a For loop counter after finalisation is not recommended, but...)
2. Starting the program's form with wsNormal and when increasing it later manually, the clipping limits of a TPaintBox.Canvas are not updated. Only forcing a repaint by covering it with another program's form and taking it away again helps.
3. The OnClick event of a ComboBox in Delphi happens only, when an Item is selected, in Lazarus it is already issued after a click for opening the Items list.
4. The stack seems to be limited to approx. 220 kB and to date I did not find the way to increase it ( (*$M, MinStackSize, MaxStackSize*) ?). A procedure trying to initialise approx. 800 kB for arrays caused a SIGSEGV.

Best regards
Jochen

Reply by email

Marco van de Voort
to Unknown author
Show quoted text 5 lines
Just recently I (Lazarus newcomer) converted a 4'500 lines tool for Finite Element mesh manipulations from Delphi 5 to Lazarus. 99.9% went extremely well (a big compliment to all contributers!), but 4 small differences made a little bit of headaches: 1. After finalisation of "For I:=B To E Do..." in Delphi is I=E+1, in Lazarus it is I=E. (I remember, that using a For loop counter after finalisation is not recommended, but...)

The latter is correct, you shouldn't. Worse it varies in Delphi too depending on version and optimization level.

(2 and 3 skipped)

4. The stack seems to be limited to approx. 220 kB and to date I did not find the way to increase it ( (*$M, MinStackSize, MaxStackSize*) ?). A procedure trying to initialise approx. 800 kB for arrays caused a SIGSEGV.
I cannot reproduce this with a small tests, millions of bytes in size. Do
you have an example?

Reply by email

Hans-Peter Diettrich
to Unknown author: Just recently I (Lazarus newcomer) converted a 4'500 lines tool for Finite Element mesh…
1. After finalisation of "For I:=B To E Do..." in Delphi is I=E+1, in Lazarus it is I=E. (I remember, that using a For loop counter after finalisation is not recommended, but...)

The for loop counter is undefined after exit from the loop. Depending on optimizations, it may be near the begin or end value, or the variable is unchanged.

DoDi

Reply by email

Aleksa Todorovic
to Unknown author: Just recently I (Lazarus newcomer) converted a 4'500 lines tool for Finite Element mesh…
4. The stack seems to be limited to approx. 220 kB and to date I did not find the way to increase it ( (*$M, MinStackSize, MaxStackSize*) ?). A procedure trying to initialise approx. 800 kB for arrays caused a SIGSEGV.

220kb sounds really large for stack. If your function is not recursive, you should consider:
a) dynamic array, or
b) static array outside the function (which is always allocated in memory), or c) static array inside the function as a const (with "Writable consts" turned on)

Reply by email

Hans-Peter Diettrich
to Aleksa Todorovic
c) static array inside the function as a const (with "Writable consts" turned on)

I'd *not* suggest to make *all* constants writeable, for only saving a few keystrokes in source code.

Doesn't FPC support kind of "static" variables in subroutines? (Delphi doesn't, but it would be a nice extension of the language...)

DoDi

Reply by email