In computing, a line number is a method used to specify a particular sequence of characters in a text file. The most common method of assigning numbers to lines is to assign every line a unique number, starting at 1 for the first line, and incrementing by 1 for each successive line. In the C programming language the line number of a source code line is one greater than the number of new-line characters read or introduced up to that point.

PropertyValue
dbpprop:abstract
  • In computing, a line number is a method used to specify a particular sequence of characters in a text file. The most common method of assigning numbers to lines is to assign every line a unique number, starting at 1 for the first line, and incrementing by 1 for each successive line. In the C programming language the line number of a source code line is one greater than the number of new-line characters read or introduced up to that point. Line numbers were a required element of syntax in some older programming languages such as GW-BASIC. The primary reason for this is that most operating systems at the time lacked interactive text editors; since the programmer's interface was usually limited to a line editor, line numbers provided a mechanism by which specific lines in the source code could be referenced for editing, and by which the programmer could insert a new line at a specific point. Line numbers also provided a convenient means of distinguishing between code to be entered into the program and commands to be executed immediately when entered by the user (which do not have line numbers). Largely due to the prevalence of interactive text editing in modern operating systems, line numbers are not a feature of most programming languages.
  • 行番号(ぎょうばんごう)とは、プログラミング言語で行頭に番号を打つことで命令文を区切る方式で、FORTRANや旧型のBASIC等に見られる。 10 A=2 20 B=3 30 PRINT A+B goto文などジャンプ系の命令文では、ラベルの代用にも使われる。本来FORTRANの行番号はラベルの用途であり、全ての行に番号を付ける必要は無かった。BASICは教育用途の言語であるため、命令が順次処理される様子を分かりやすく表現するようそのような形態になったものと思われる。この特徴は「BASIC最大の設計ミス」と批判されることが多く、Visual Basicなどでは姿を消している。 40 goto 10 BASICでは命令文を打ち込んで改行すると適度な数字間隔(主に10刻み)で自動に行番号を打ち込む仕様(自動的な行番号の採番はAUTO命令によって制御できる処理系もある)になっているため、行間に命令文を追加する場合には、手動でその間の行番号を打ち込む(10と20の間で15、とか)。 また、スクリーンエディタ機能が未発達だった初期のコンピュータのBASICなどは行番号を指定してプログラム内容の表示、編集を行うラインエディタ指向での範囲指定という性格もある。そのためにLIST(指定した行番号の範囲のリストを表示する)、RENUM(行番号を一定間隔で振りなおす)といった命令も存在している。 たとえば、行番号に依存したBASIC処理系で、上記プログラムの行番号20のB=3をB=4と編集する場合には以下のように作業する。 LIST 20 と入力して、行番号20の内容を表示させる その下の行に20 B=3という現在のその行の内容が表示される カーソルを移動させ、3を4に編集する エンターキーを押下する。これにより、メモリ内の行番号20の内容が置き換わる。 今日では、スクリーンエディタが発達しているため、最近の言語処理系ではこのような作業のために行番号が使われることはなくなった。
dbpprop:hasPhotoCollection
rdfs:comment
  • In computing, a line number is a method used to specify a particular sequence of characters in a text file. The most common method of assigning numbers to lines is to assign every line a unique number, starting at 1 for the first line, and incrementing by 1 for each successive line. In the C programming language the line number of a source code line is one greater than the number of new-line characters read or introduced up to that point.
rdfs:label
  • Line number
  • 行番号
owl:sameAs
skos:subject
foaf:page
is dbpprop:redirect of