Vinzent Höfler wrote:
And to be honest, there aren't many cases where you really can ignore the
result of the function and keep the good conscience of having it done right. If
a function in Pascal returns something it's usually useful.
There are many cases like that, at least in my
Datum: Thu, 14 Aug 2008 08:48:58 -0400
Von: Jeff Wormsley [EMAIL PROTECTED]
be forced to check for conditions that aren't likely to ever occur. The
extra expense in development time isn't worth the risk of not doing the
checks. That cost vs risk analysis will be different for everyone.
Sometimes we forgot whether a function argument is passed by reference or by
value. What if the result is actually important? For instance, consider the
following (WARNING: True story):
function Align(Addr: Pointer; Alignment: PtrUInt): Pointer;
then we forgot that Addr is passed by value, so
Op woensdag 13-08-2008 om 01:27 uur [tijdzone -0700], schreef leledumbo:
Sometimes we forgot whether a function argument is passed by reference
or by
value. What if the result is actually important? For instance,
consider the
following (WARNING: True story):
That's not so strange story. I
Joost van der Sluis wrote:
And there's no way the compiler can detect this.
I don't think so. The compiler understand that a procedure doesn't return a
value while a function does (i.e. trying to return a value from a procedure
causes compile error). I haven't checked how compiler formats
leledumbo wrote:
Joost van der Sluis wrote:
And there's no way the compiler can detect this.
I don't think so. The compiler understand that a procedure doesn't return a
value while a function does (i.e. trying to return a value from a procedure
causes compile error). I haven't checked how
Vinzent Höfler wrote:
Yes. Turn Extended Syntax off {$X-}, then a function result must be
assigned to a variable. At least it used to be that way.
...
so inherited Create did not compile anymore (and I remember that any
attempt to assign this result to a dummy variable even failed). So,
Joost van der Sluis wrote:
Ok, so I misunderstood you. You want that the compiler complains if you
don't assign the result of a function. While that can be done, I don't
think you want that.
Well, don't decide for others, please. I am a stupid programmmer, I am
making mistakes all the time,
Vinzent Höfler schreef:
Joost van der Sluis wrote:
Ok, so I misunderstood you. You want that the compiler complains if you
don't assign the result of a function. While that can be done, I don't
think you want that.
Well, don't decide for others, please. I am a stupid programmmer, I am
Vincent Snijders wrote:
Vinzent Höfler schreef:
Joost van der Sluis wrote:
Ok, so I misunderstood you. You want that the compiler complains if you
don't assign the result of a function. While that can be done, I don't
think you want that.
Well, don't decide for others, please. I am a stupid
Vinzent Höfler schreef:
Vincent Snijders wrote:
Vinzent Höfler schreef:
Joost van der Sluis wrote:
Ok, so I misunderstood you. You want that the compiler complains if you
don't assign the result of a function. While that can be done, I don't
think you want that.
Well, don't decide for
Original-Nachricht
Datum: Wed, 13 Aug 2008 16:02:10 -0400
Von: Jeff Wormsley [EMAIL PROTECTED]
An: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org
Betreff: Re: [fpc-pascal] Compiler option to check return value ignorance
Vinzent Höfler wrote:
I just
|if not SomeFunction Constant_Of_Sometype then {null};
Of course, usually it's without the not... ;) And with Boolean functions it's
a bit easier.
And I should have added that I never put in comments what I can easily put in
code. At first, comments don't get compiled, and second, nobody
13 matches
Mail list logo