Scott Moore wrote:
No, I still use the stupid way:
function stuff: integer;
begin
stuff := 0
end;
To me the idea is, parameters can be safely ignored (there is also a "reference check off" switch /nrf or /norefer, but that affects the entire program). Functions always return *something*, so you might as well specify what it is, even for a dummy function. Otherwise, you are asking the compiler to guess for you.
Indeed. Actually according to the standards it's an *error* if you don't (and GPC treats it so). What I meant is for the caller to ignore the result of a function (i.e., basically, to use a function like a procedure). Besides the mentioned useless results in C functions, there can be useful cases even in Pascal code where a result is sometimes, but not always needed.
To come clean, I use the /norefer flag a lot on new code. Hey, I'm lazy. On the other hand, my previous compiler (SVS 386 Pascal) either didn't do reference checking, or I didn't have it on, and I found my code littered with excess variables when I moved to IP Pascal.
Same here for code I (or someone else) previously compiled with Borland Pascal or with GPC without warnings. Frank -- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/, 7977168E GPC To-Do list, latest features, fixed bugs: http://www.gnu-pascal.de/todo.html NEW! GPC download signing key: ACB3 79B2 7EB2 B7A7 EFDE D101 CD02 4C9D 0FE0 E5E8