|
In computer programming, a comment is a programmer-readable annotation in the source code of a computer program. They are added with the purpose of making the source code easier to understand, and are generally ignored by compilers and interpreters.〔Source code can be divided into ''program code'' (which consists of machine-translatable instructions); and ''comments'' (which include human-readable notes and other kinds of annotations in support of the program code).〕〔For purposes of this article, programming language comments are treated as indistinct from comments that appear in markup languages, configuration files and other similar contexts. Moreover, markup language is often closely integrated with programming language code, especially in the context of code generation. See e.g., , 〕 The syntax of comments in various programming languages varies considerably. As well as of direct use to any programmer reading the source code, comments are sometimes processed in various ways to generate documentation external to the source code itself by documentation generators, or used for integration with source code management systems and other kinds of external programming tools. The flexibility provided by comments allows for a wide degree of variability, but formal conventions for their use are commonly part of programming style guides. == Overview == Comments are generally formatted as either ''block comments'' (also called ''prologue comments'' or ''stream comments'') or ''line comments'' (also called ''inline comments''). Block comments delimit a region of source code which may span multiple lines. This region is specified with a ''start'' delimiter and an ''end'' delimiter. Some programming languages (such as MATLAB) allow block comments to be recursively nested inside one another, but others (such as Java) do not.〔(【引用サイトリンク】 url = http://javadude.com/articles/comments.html )〕 Line comments either start with a comment delimiter and continue until the end of the line, or in some cases, start at a specific column (character line offset) in the source code, and continue until the end of the line.〔 Some programming languages employ both block and line comments with different comment delimiters. For example, C++ has block comments delimited by / and that can span multiple lines and line comments delimited by // . Other languages support only one type of comment. For example, Ada comments are line comments: they start with -- and continue to the end of the line.〔抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Comment (computer programming)」の詳細全文を読む スポンサード リンク
|