GNU Pascal Homepage - gpc - gpc-announce - gpc-de - gpc-doc
Diese Seite auf deutsch

Mail #10809

Back to main page of archive

Previous mail   Next mail   Unformatted/full headers
Overview  10 days   Subject   Date   Thread   Author  

From: Frank Heckenbach
Subject: Unused parameter warnings
Date: 23 Sep 2004, 06:36:28

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

Previous mail   Next mail   Unformatted/full headers
Overview  10 days   Subject   Date   Thread   Author  


In reply to

Author Subject Date
Peter N Lewis Unused parameter warnings 21 Sep 2004, 22:17:25
CBFalconer Unused parameter warnings 22 Sep 2004, 07:12:36
Scott Moore Unused parameter warnings 22 Sep 2004, 09:30:35
Frank Heckenbach Unused parameter warnings 22 Sep 2004, 19:33:12
Scott Moore Unused parameter warnings 22 Sep 2004, 17:00:27

Back to main page of archive


Note: This page contains information that does not originate from the owner of this web site, but from the authors of the mails archived. The owner of this web site is not responsible for the content of such information. Any use of that infomation requires the consent of the respective author.

Where WWW addresses (URLs) in the mails archived are marked as hyperlinks, this is only for the comfort of the reader. The content of the web pages linked to like this does not necessarily reflect the opinion of the owner of this web site or of the authors of the mails archived. The owner of this web site is not responsible for the content of such web pages. Those pages are explicitly not to be considered as part of the content of this page, but merely as references.


This page was created by Crystal 0.999 (Linux 2.4.27/i686).