[fpc-pascal] Compiler option to check return value ignorance
leledumbo
leledumbo_cool at yahoo.co.id
Wed Aug 13 10:27:42 CEST 2008
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 instead of stating
APointer:=Align(APointer,TheAlignment);
we only call
Align(APointer,TheAlignment);
which is harmful as we may need to have the pointer aligned. It's useful,
believe me (Nimrod even doesn't allow it without a special statement).
PS: I think a warning (or note or hint, whichever suits best) is enough.
--
View this message in context: http://www.nabble.com/Compiler-option-to-check-return-value-ignorance-tp18958911p18958911.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
More information about the fpc-pascal
mailing list