On Sat, Mar 2, 2013 at 7:51 AM, Michael Van Canneyt
wrote:
>
>
> On Sat, 2 Mar 2013, Howard Page-Clark wrote:
>
>> On 02/03/13 5:45, Flávio Etrusco wrote:
>>>
>>> On Fri, Mar 1, 2013 at 11:49 PM, Xiangrong Fang wrote:
(...)
>
> Also, setting Self to nil is nonsense.
>
> If you do FreeAndNil(
Sven Barth schrieb:
If you want to ensure that MyInstance is Nil you need to do it like this:
=== code begin ===
try
MyInstance := TMyClass.Create('AnNonExistentFile');
except
MyInstance := Nil;
end;
=== code end ===
When an exception occurs in Create, the assignment will never take
pl
On 02/03/13 10:51, Michael Van Canneyt wrote:
This will definitely cause a memory leak, because the FPC code does not
know that an exception occurred in the constructor (you catch it with
Except), and hence will not call the destructor.
Thanks for the correction and explanation.
Howard
--
_
On Sat, 2 Mar 2013, Howard Page-Clark wrote:
On 02/03/13 5:45, Flávio Etrusco wrote:
On Fri, Mar 1, 2013 at 11:49 PM, Xiangrong Fang wrote:
Hi there,
If my class constructor looks like this:
constructor TMyClass.Create(fn: string);
begin
sl := TStringList.Create;
try
fs := TFil
On 02/03/13 5:45, Flávio Etrusco wrote:
On Fri, Mar 1, 2013 at 11:49 PM, Xiangrong Fang wrote:
Hi there,
If my class constructor looks like this:
constructor TMyClass.Create(fn: string);
begin
sl := TStringList.Create;
try
fs := TFileStream.Create(fn, fmOpenRead);
except
se
On 02.03.2013 03:49, Xiangrong Fang wrote:
Hi there,
If my class constructor looks like this:
constructor TMyClass.Create(fn: string);
begin
sl := TStringList.Create;
try
fs := TFileStream.Create(fn, fmOpenRead);
except
self.Destroy;
end;
end;
No, this is a bad idea. If
On Fri, Mar 1, 2013 at 11:49 PM, Xiangrong Fang wrote:
> Hi there,
>
> If my class constructor looks like this:
>
> constructor TMyClass.Create(fn: string);
> begin
> sl := TStringList.Create;
> try
> fs := TFileStream.Create(fn, fmOpenRead);
> except
> self.Destroy;
> end;
> end;
Hi there,
If my class constructor looks like this:
constructor TMyClass.Create(fn: string);
begin
sl := TStringList.Create;
try
fs := TFileStream.Create(fn, fmOpenRead);
except
self.Destroy;
end;
end;
I create the objec like: MyInstance :=
TMyClass.Create('AnNonExistentFile');
On Sat, Mar 12, 2011 at 10:53:45PM +0100, Bernd wrote:
> 2011/3/9 Hans-Peter Diettrich :
>
> > An exception down in some calculation doesn't give you any clue of what
> > exactly went wrong, only that *something* went wrong.
>
> It can often be useful and remove a lot of if/else for cleanly exiti
Bernd schrieb:
2011/3/9 Hans-Peter Diettrich :
An exception down in some calculation doesn't give you any clue of what
exactly went wrong, only that *something* went wrong.
It can often be useful and remove a lot of if/else for cleanly exiting
a bunch of nested loops and functions (and also s
2011/3/9 Hans-Peter Diettrich :
> An exception down in some calculation doesn't give you any clue of what
> exactly went wrong, only that *something* went wrong.
It can often be useful and remove a lot of if/else for cleanly exiting
a bunch of nested loops and functions (and also save clock cycle
Il 09/03/2011 17:29, Mattias Gaertner ha scritto:
Some LCL widgetsets use this:
{$if defined(cpui386) or defined(cpux86_64)}
{$IFDEF windows}
Set8087CW($133F);
{$ELSE}
SetExceptionMask(GetExceptionMask + [exZeroDivide,exInvalidOp]);
{$ENDIF}
{$ifend}
thanks!
On Wed, 09 Mar 2011 14:17:19 +0100
Andrea Mauri wrote:
> Il 09/03/2011 12:49, Hans-Peter Diettrich ha scritto:
> > I'd check this just before the operation, then you won't get an
> > exception at all. You can wrap that in a MyLn function, if you need ln()
> > more often.
> ok. I know. but my ques
Il 09/03/2011 12:49, Hans-Peter Diettrich ha scritto:
I'd check this just before the operation, then you won't get an
exception at all. You can wrap that in a MyLn function, if you need ln()
more often.
ok. I know. but my question is more general and it is:
The gui app handles this operation gi
Andrea Mauri schrieb:
The calculations are under try except.
For what reason?
An exception down in some calculation doesn't give you any clue of what
exactly went wrong, only that *something* went wrong.
Sometimes happens that the argument (a) of b:= ln(a) is negative.
I'd check this ju
Dear all,
I developed an application that perform some calculations.
This application has a gui version and a console version, it runs on
windows and linux.
Both apps use the same units for calculation, only the interface units
are different.
I have some problems in the exception handling.
Some
Hi Lazarus.
Please forgive my ignorance if I'm asking a stupid question.
In the DeliverMessage function in LCLMessageGlue the
Application.HandleException is called with __nil__ as argument. Why is
the actual target used here? It is already available at this point, and
the callback function a
17 matches
Mail list logo