home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!cs.utexas.edu!csc.ti.com!tilde.csc.ti.com!mksol!mccall
- From: mccall@mksol.dseg.ti.com (fred j mccall 575-3539)
- Subject: Re: Where to include
- Message-ID: <1993Jan12.185243.20147@mksol.dseg.ti.com>
- Organization: Texas Instruments Inc
- References: <C0ID0z.504@ulowell.ulowell.edu>
- Date: Tue, 12 Jan 1993 18:52:43 GMT
- Lines: 37
-
- In <C0ID0z.504@ulowell.ulowell.edu> vpham@cs.ulowell.edu (vinh) writes:
-
-
-
- >fun()
- >{
- >}
-
- >#include <stdio.h>
-
-
- >fun2()
- >{
- > printf("test...");
- >}
-
- >we argued at work about where to put stdio.h; obviously fun()
- >isn't calling anything declared in <stdio.h>, so don't think
- >stdio.h should be included at the beginning of the file; my
- >co-fellow worker thinks it's ugly ; what do you think?
- >what does the standard say? what does K&R say?
-
- This is one of those maintenance oriented stylistic issues. Putting
- the '#include' statements anywhere but the top of the file is a
- maintenance problem waiting to happen. The '#include' has file scope,
- and so should reasonably occur once at the top of the file. Doing it
- the way you show above almost 'feels' like you want it to have FUNCTION
- scope, instead.
-
-
-
-
- --
- "Insisting on perfect safety is for people who don't have the balls to live
- in the real world." -- Mary Shafer, NASA Ames Dryden
- ------------------------------------------------------------------------------
- Fred.McCall@dseg.ti.com - I don't speak for others and they don't speak for me.
-