[fpc-pascal] New Get Lazarus Initiative

2015-02-03 Thread Anthony Walter
I am please to announce the launch of a new initiative to promote Free Pascal and Lazarus. The hub of this initiative is http://www.getlazarus.org The get Lazarus initiative aims to an reintroduce Lazarus to the software development world. To aide in this endeavor we've created our own special Laz

Re: [fpc-pascal] why fpc do not use a known return function value

2015-02-03 Thread Florian Klämpfl
Am 03.02.2015 um 12:25 schrieb misu kun: >> mind sharing the C code? > > int c ; > int test( int p){ > int i; > i = p; > return (i+2+c+2+c+2+c); > } > int main(){ > c = test(128); > } I do not see why it is worth trying to optimize such code. No well-written real world program contains c

Re: [fpc-pascal] SDL 2.xx

2015-02-03 Thread Brian
Threading SDL 2.03 is not particularly difficult if you observe the rules that a texture/renderer must reside in the same thread that created the window and (it appears) there is only one event (which as you mentioned makes sense) , and in my case the event handler is in a thread. SDL 2.03 has so

Re: [fpc-pascal] why fpc do not use a known return function value

2015-02-03 Thread Jonas Maebe
On 03 Feb 2015, at 15:58, leledumbo wrote: int c ; int test( int p){ int i; i = p; return (i+2+c+2+c+2+c); } int main(){ c = test(128); } Hmmyes, from C perspective, there's nothing can modify c before it's used the first time (unless you inject the startup code). Therefore, the c

Re: [fpc-pascal] why fpc do not use a known return function value

2015-02-03 Thread leledumbo
> int c ; > int test( int p){ > int i; > i = p; > return (i+2+c+2+c+2+c); > } > int main(){ > c = test(128); > } Hmmyes, from C perspective, there's nothing can modify c before it's used the first time (unless you inject the startup code). Therefore, the compiler is safe to ass

Re: [fpc-pascal] why fpc do not use a known return function value

2015-02-03 Thread Jonas Maebe
On 03 Feb 2015, at 14:27, Sven Barth wrote: But three times the addition of "c" will stay, right? Afterall globals are considered volatile... Yes, you're right. Sorry, especially to Jeppe who had it right from the start. I obviously wasn't thinking straight :/ Jonas ___

Re: [fpc-pascal] why fpc do not use a known return function value

2015-02-03 Thread Sven Barth
Am 03.02.2015 12:13 schrieb "Jonas Maebe" : > > On 03/02/15 11:33, misu kun wrote: > > i mean even if you initilize c with a const value. > > That is irrelevant. > > > i enabled {$optimization constprop} but nothing changed ! > > I misread the original assembler code you posted, due to how you phra

Re: [fpc-pascal] FieldAddress

2015-02-03 Thread Sven Barth
Am 03.02.2015 12:56 schrieb "Torsten Bonde Christiansen" : > So FieldAddress can only access published fields? Correct. For anything else you'll have to wait till we have Delphi's extended RTTI. Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists

Re: [fpc-pascal] FieldAddress

2015-02-03 Thread Torsten Bonde Christiansen
On 2015-02-03 12:30, silvioprog wrote: On Tue, Feb 3, 2015 at 6:17 AM, Torsten Bonde Christiansen mailto:t...@epidata.info>> wrote: Hi, What does it take for a class to access a field using FieldAddress(...)? I have tried with both typeinfo on/off ({M+}), placing the field

Re: [fpc-pascal] FieldAddress

2015-02-03 Thread silvioprog
On Tue, Feb 3, 2015 at 6:17 AM, Torsten Bonde Christiansen wrote: > Hi, > > What does it take for a class to access a field using FieldAddress(...)? > > I have tried with both typeinfo on/off ({M+}), placing the field in > private/protected/public/published > sections but to no avail. > > My sim

Re: [fpc-pascal] why fpc do not use a known return function value

2015-02-03 Thread misu kun
> mind sharing the C code? int c ; int test( int p){ int i; i = p; return (i+2+c+2+c+2+c); } int main(){ c = test(128); } ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] why fpc do not use a known return function value

2015-02-03 Thread Jonas Maebe
On 03/02/15 11:01, je...@j-software.dk wrote: > Constant propagation won't work on global variables in fpc because they > currently are always considered volatile. The propagation is into the inlined body of the function, not the value of the global variable 'c' after it has been assigned. Jonas

Re: [fpc-pascal] why fpc do not use a known return function value

2015-02-03 Thread Jonas Maebe
On 03/02/15 11:33, misu kun wrote: > i mean even if you initilize c with a const value. That is irrelevant. > i enabled {$optimization constprop} but nothing changed ! I misread the original assembler code you posted, due to how you phrased the subject of your mail. The inline function is actual

Re: [fpc-pascal] why fpc do not use a known return function value

2015-02-03 Thread leledumbo
> while the same program in c compiled with old version of gcc generate this asm > which is optimal mind sharing the C code? -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/why-fpc-do-not-use-a-known-return-function-value-tp5720901p5720909.html Sent from the

Re: [fpc-pascal] why fpc do not use a known return function value

2015-02-03 Thread jeppe
Constant propagation won't work on global variables in fpc because they currently are always considered volatile. -- Oprindelig besked--Fra: Jonas MaebeDato: tir., 3. feb. 2015 10:24Til: FPC-Pascal users discussions;Emne:Re: [fpc-pascal] why fpc do not use a known return fun

Re: [fpc-pascal] why fpc do not use a known return function value

2015-02-03 Thread misu kun
i mean even if you initilize c with a const value. i enabled {$optimization constprop} but nothing changed ! 2015-02-03 11:19 UTC+01:00, misu kun : > thanks , > even if you remove c and call test() inside writeln for example, > still the same thing . >

Re: [fpc-pascal] why fpc do not use a known return function value

2015-02-03 Thread misu kun
thanks , even if you remove c and call test() inside writeln for example, still the same thing . ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] why fpc do not use a known return function value

2015-02-03 Thread Jonas Maebe
On 02/02/15 13:56, misu kun wrote: > in this program test function has a known return value , and should be > calculated in compile time , but fpc make it in real time !!! Constant propagation is a new feature in the upcoming FPC release: http://wiki.freepascal.org/FPC_New_Features_Trunk#Constant_

Re: [fpc-pascal] why fpc do not use a known return function value

2015-02-03 Thread Mark Morgan Lloyd
misu kun wrote: Hi in this program test function has a known return value , and should be calculated in compile time , but fpc make it in real time !!! - program test; var c : int32; function test( p: int32): int32; inline; var i : int32; begin i := p; test := i+2+c+2+c+2+

[fpc-pascal] FieldAddress

2015-02-03 Thread Torsten Bonde Christiansen
Hi, What does it take for a class to access a field using FieldAddress(...)? I have tried with both typeinfo on/off ({M+}), placing the field in private/protected/public/published sections but to no avail. My simple code is: TMyObject = class private FRef: TMyObject; procedure SetRef(AVa

Re: [fpc-pascal] SDL 2.xx

2015-02-03 Thread Michael Schnell
On 02/02/2015 03:54 PM, Brian wrote: When the event handler (only one handler) is put in a thread , the event can be detected from different windows , those created in the thread and those created in the main thread (program) , by using SDL_GetWindowID() to get the identify of a window (WindowID)