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

Joost van der Sluis joost at cnoc.nl
Wed Aug 13 14:57:03 CEST 2008


Op woensdag 13-08-2008 om 02:52 uur [tijdzone -0700], schreef 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 each
> function/procedure in the PPU but I think there should be an information
> whether it's a function or procedure. So, I think it's possible to detect if
> a function call is assigned to a variable or not.

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. This functionality is used far too often, and those
warnings would become very annoying.

Joost.




More information about the fpc-pascal mailing list