Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Transclusion
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Origins== The concept of reusing file content began with computer programming languages: [[COBOL]] in 1960,<ref>{{Cite book|url=http://bitsavers.trailing-edge.com/pdf/codasyl/COBOL_Report_Apr60.pdf#page=56|title=Initial Specifications for a COMMON BUSINESS ORIENTED LANGUAGE (COBOL) for Programming Electronic Digital Computers|date=April 1960|publisher=Department of Defense|location=Washington|pages=V-27|quote=INCLUDE: Function: To save the programmer effort by automatically incorporating library subroutines into the source program.}}</ref> followed by [[BCPL]], [[PL/I]], [[C (programming language)|C]],<ref>{{Cite journal <!-- Citation bot bypass-->|last=Ritchie|first=Dennis M.|author-link=Dennis Ritchie|date=1993-03-01|title=The development of the C language|journal=ACM SIGPLAN Notices|language=EN|volume=28|issue=3|pages=201–208|doi=10.1145/155360.155580|url=https://dl.acm.org/doi/abs/10.1145/155360.155580|archive-url=https://web.archive.org/web/20200227090139/https://dl.acm.org/doi/abs/10.1145/155360.155580|archive-date=27 February 2020|quote=Many other changes occurred around 1972-3, but the most important was the introduction of the [[C preprocessor|preprocessor]], partly at the urging of Alan Snyder [Snyder 74], but also in recognition of the utility of the the[sic]<!--Original source has the duplicate word! --> file-inclusion mechanisms available in [[BCPL]] and [[PL/I]]. Its original version was exceedingly simple, and provided only included files and simple [[Sed#Substitution command|string replacements]]: [[Include directive|#include]] and #define of parameterless macros. Soon thereafter, it was extended, mostly by [[Mike Lesk]] and then by John Reiser, to incorporate [[Macro (computer science)#Parameterized macro|macros with arguments]] and [[conditional compilation]]. The preprocessor was originally considered an optional adjunct to the language itself.}} [http://www.jslint.com/chistory.html Alt URL] {{Webarchive|url=https://web.archive.org/web/20200204075428/http://jslint.com/chistory.html |date=2020-02-04 }}</ref> and by 1978, even [[Fortran#Transition to ANSI Standard Fortran|FORTRAN]]. An [[include directive]] allows common [[source code]] to be reused while avoiding the pitfalls of [[Copy-and-paste programming|copy-and-paste-programming]] and [[hard coding]] of constants. As with many innovations, a problem developed. Multiple include directives may provide the same content as another include directive, inadvertently causing repetitions of the same source code into the final result, resulting in an [[Syntax error|error]]. [[Include guard]]s help solve this by, after a single inclusion of content, thereafter omitting the duplicate content.<ref>{{Cite book|last1=Stallman|first1=Richard M.|chapter-url=https://scicomp.ethz.ch/public/manual/gcc/6.3.0/cpp.pdf#page=14|title=The C Preprocessor: For gcc version 6.3.0 (GCC)|last2=Weinberg|first2=Zachary|pages=10–11|chapter=Header Files|quote=Alternatives to Wrapper #ifndef : [[C preprocessor|CPP]] supports two more ways of indicating that a header file should be read only once. Neither one is as portable as a wrapper ‘#ifndef’ and we recommend you do not use them in new programs, with the caveat that ‘#import’ is standard practice in [[Objective-C]]. [...] Another way to prevent a header file from being included more than once is with the ‘[[pragma once|#pragma once]]’ directive. If ‘#pragma once’ is seen when scanning a header file, that file will never be read again, no matter what.|author-link=Richard Stallman}}</ref> The idea of a single, reusable, source for information lead to concepts like: [[Don't repeat yourself]] and the [[Abstraction principle (computer programming)|abstraction principle]]. A further use was found to make programs more [[Software portability|portable]]. Portable source code uses an include directive to specify a [[C file input/output|standard library]], which contains system specific source code that varies with each computer environment.<ref>{{Cite journal|last1=Johnson|first1=S. C.|author-link=Stephen C. Johnson|last2=Ritchie|first2=D. M.|author-link2=Dennis Ritchie|date=July–August 1978|title=UNIX time-sharing system: Portability of C programs and the UNIX system|journal=The Bell System Technical Journal|volume=57|issue=6|pages=2021–2048|doi=10.1002/j.1538-7305.1978.tb02141.x|s2cid=17510065|issn=0005-8580|access-date=27 February 2020|url=https://ieeexplore.ieee.org/document/6770409|quote=Even before the advent of the [[Interdata 7/32 and 8/32|Interdata]] machine, it as realized, as mentioned above, that many programs depended to an undesirable degree not only on [[Unix|UNIX]] I/O conventions but on details of particularly favorable buffering strategies for the [[PDP-11]]. A package of routines, called the "[[C file input/output|portable I/O library]]," was written by [[Mike Lesk|M. E. Lesk]] and implemented on the [[Honeywell 6000 series|Honeywell]] and IBM machines as well as the PDP-11 in a generally successful effort to overcome the deficiencies of earlier packages|url-access=subscription}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)