Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!eecae!netnews.upenn.edu!rutgers!cmcl2!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: where do you put prototype declarations? Message-ID: <9520@smoke.BRL.MIL> Date: 28 Jan 89 03:52:54 GMT References: <584@mccc.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 18 In article <584@mccc.UUCP> pjh@mccc.UUCP (Pete Holsberg) writes: >Does it make a significant difference? If so, what is it? Thanks. Not really; the external declarations remain in scope until the end of the translation unit and the internal ones go out of scope at the end of the block within which they're declared. For extern functions and data, there cannot be conflicting definitions anyway, so one might as well use file scope for their declarations. The only practical uses I can think of for hiding declarations of externs outside a block would generally be considered poor style. There are languages that require explicit "importing" of identifiers in order to use them in a block. Programmers who think along those lines may well prefer to write their C code like that. Personally, I prefer to finish the job of declaring externs just after the #includes that started the job near the start of the source file. It also usually saves on keystrokes (or mouse clicks, for "sam" users) since only one declaration is needed for each extern that way.