www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/10/11/17:56:12

Date: Wed, 11 Oct 1995 17:01:28 -0400
From: kagel AT quasar DOT bloomberg DOT com
To: davis AT space DOT mit DOT edu
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Prototype Checking
Reply-To: kagel AT ts1 DOT bloomberg DOT com

   Errors-To: postmaster AT ns1
   Xref: news-dnh.mv.net comp.os.msdos.djgpp:2569
   Path: news-dnh.mv.net!mv!news.sprintlink.net!howland.reston.ans.net!newsfeed.internetmci.com!bloom-beacon.mit.edu!senator-bedfellow.mit.edu!space.mit.edu!davis
   From: davis AT space DOT mit DOT edu (John E. Davis)
   Newsgroups: comp.os.msdos.djgpp
   Date: 11 Oct 1995 19:25:53 GMT
   Organization: Center for Space Research
   Lines: 35
   References: <DGAnBG DOT 3Bq AT jade DOT mv DOT net>
   Reply-To: davis AT space DOT mit DOT edu
   Nntp-Posting-Host: wiwaxia.mit.edu
   X-Newsreader: slrn (0.7.9.0)
   Dj-Gateway: from newsgroup comp.os.msdos.djgpp
   Content-Type: text
   Content-Length: 1278

   On Wed, 11 Oct 1995 16:03:43 GMT, kagel AT quasar DOT bloomberg DOT com
   <kagel AT quasar DOT bloomberg DOT com> wrote: 
    :     -Wmissing-prototypes
    :         Warn if a global function is defined without a previous prototype
    :         declaration.  This warning is issued even if the definition
    :         itself provides a prototype.  The aim is to detect global
    :         functions that fail to be declared in header files.

   I would like to see this extended to variable declarations as well.  Let me
   be more specific.  Consider two files: header.h amd file.c:

   /* header.h */
   extern int function_one (void);
   extern int Variable_One;

   /* file.c */
   #include "header.h"
   int Variable_One;
   static int Variable_Two;
   int function_one (void) { ... }
   int function_two (void) { ... }
   static int function_three (void) {...}


   ....
   static.  I would like to have the ability to do this for variables as well.
   That is, I would like to see a warning for Variable_One but not for
   Variable_Two.

Right, nice but not practical.  The warning generated by -Wmissing-prototypes
is determined by the declaration of a function before a prototype is found.  
The declaration of the potentially global variable 'Variable_One' would have 
no prior prototype and a preceding extern definition would be illegal as the 
following declaration would cause a name clash.

Also this would need to be a change to GNU C, of which DJGCC is just a port.
You would need to propose such a warning to the FSF directly, rather than here.

-- 
Art S. Kagel, kagel AT ts1 DOT bloomberg DOT com

Variety is the soul of pleasure.  --  Aphra Behn

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019