[fpc-devel] Hom to initialize an object (old style object, not TObject)

2013-11-01 Thread Martin
If I have the code as shown at the end of the mail, i get project1.lpr(6,9) Warning: Function result variable does not seem to initialized but how can I initialize it? Unit1 unit Unit1; {$mode objfpc}{$H+} interface uses Classes, SysUtils; type TBar = object private a:

Re: [fpc-devel] Hom to initialize an object (old style object, not TObject)

2013-11-01 Thread Tomas Hajny
On Fri, November 1, 2013 15:59, Martin wrote: If I have the code as shown at the end of the mail, i get project1.lpr(6,9) Warning: Function result variable does not seem to initialized but how can I initialize it? Unit1 unit Unit1; {$mode objfpc}{$H+} interface uses Classes,

Re: [fpc-devel] Hom to initialize an object (old style object, not TObject)

2013-11-01 Thread Martin
On 01/11/2013 15:10, Tomas Hajny wrote: Sorry if I overlooked something, but where is the variable of that type declared in your code? These objects may be either declared statically (var B: TBar) or dynamically (Result := New (TBar.Init) - but then the return value must be of type PBar, not

Re: [fpc-devel] Hom to initialize an object (old style object, not TObject)

2013-11-01 Thread Vincent Snijders
Why is it old style, if you use mode objfpc? Vincent ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel

Re: [fpc-devel] Hom to initialize an object (old style object, not TObject)

2013-11-01 Thread Jonas Maebe
On 01/11/13 15:59, Martin wrote: If I have the code as shown at the end of the mail, i get project1.lpr(6,9) Warning: Function result variable does not seem to initialized but how can I initialize it? The warning is wrong. Jonas ___ fpc-devel

Re: [fpc-devel] Hom to initialize an object (old style object, not TObject)

2013-11-01 Thread Martin
On 01/11/2013 16:00, Vincent Snijders wrote: Why is it old style, if you use mode objfpc? I did just look for a word, that would help distinguish it from TObject/class Afaik object existed before class? ___ fpc-devel maillist -

Re: [fpc-devel] Hom to initialize an object (old style object, not TObject)

2013-11-01 Thread Tomas Hajny
On Fri, November 1, 2013 16:18, Martin wrote: On 01/11/2013 15:10, Tomas Hajny wrote: Sorry if I overlooked something, but where is the variable of that type declared in your code? These objects may be either declared statically (var B: TBar) or dynamically (Result := New (TBar.Init) - but