Re: [fpc-pascal] Compiler option to check return value ignorance

2008-08-14 Thread Jeff Wormsley
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

Re: [fpc-pascal] Compiler option to check return value ignorance

2008-08-14 Thread Vinzent Höfler
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.

[fpc-pascal] Compiler option to check return value ignorance

2008-08-13 Thread 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): function Align(Addr: Pointer; Alignment: PtrUInt): Pointer; then we forgot that Addr is passed by value, so

Re: [fpc-pascal] Compiler option to check return value ignorance

2008-08-13 Thread Joost van der Sluis
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

Re: [fpc-pascal] Compiler option to check return value ignorance

2008-08-13 Thread leledumbo
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

Re: [fpc-pascal] Compiler option to check return value ignorance

2008-08-13 Thread Vinzent Höfler
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

Re: [fpc-pascal] Compiler option to check return value ignorance

2008-08-13 Thread leledumbo
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,

Re: [fpc-pascal] Compiler option to check return value ignorance

2008-08-13 Thread Vinzent Höfler
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,

Re: [fpc-pascal] Compiler option to check return value ignorance

2008-08-13 Thread Vincent Snijders
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

Re: [fpc-pascal] Compiler option to check return value ignorance

2008-08-13 Thread Vinzent Höfler
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

Re: [fpc-pascal] Compiler option to check return value ignorance

2008-08-13 Thread Vincent Snijders
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

Re: [fpc-pascal] Compiler option to check return value ignorance

2008-08-13 Thread Vinzent Höfler
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

Re: [fpc-pascal] Compiler option to check return value ignorance

2008-08-13 Thread Vinzent Höfler
|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