Node:fence, Next:fencepost error, Previous:feetch feetch, Up:= F =

fence n. 1.

A sequence of one or more distinguished (out-of-band) characters (or other data

items), used to delimit a piece of data intended to be treated as

a unit (the computer-science literature calls this a `sentinel').

The NUL (ASCII 0000000) character that terminates strings in C is

a fence. Hex FF is also (though slightly less frequently) used

this way. See zigamorph. 2. An

extra data value inserted in an array or other data structure in

order to allow some normal test on the array's contents also to

function as a termination test. For example, a highly optimized

routine for finding a value in an array might artificially place

a copy of the value to be searched for after the last slot of the

array, thus allowing the main search loop to search for the value

without having to check at each pass whether the end of the array

had been reached. 3. [among users of optimizing compilers] Any

technique, usually exploiting knowledge about the compiler, that

blocks certain optimizations. Used when explicit mechanisms are

not available or are overkill. Typically a hack: "I call a dummy

procedure there to force a flush of the optimizer's

register-coloring info" can be expressed by the shorter "That's a

fence procedure".

Node:fencepost error, Next:fiber-seeking

backhoe, Previous:fence,

Up:= F =

fencepost error n.

1. [common] A problem with the discrete equivalent of a

boundary condition, often exhibited in programs by iterative

loops. From the following problem: "If you build a fence 100 feet

long with posts 10 feet apart, how many posts do you need?"

(Either 9 or 11 is a better answer than the obvious 10.) For

example, suppose you have a long list or array of items, and want

to process items m through n; how many items are there? The

obvious answer is n - m, but that is off by one; the right answer

is n - m + 1. A program that used the `obvious' formula would

have a fencepost error in it. See also zeroth and off-by-one error, and note that not

all off-by-one errors are fencepost errors. The game of Musical

Chairs involves a catastrophic off-by-one error where N people

try to sit in N - 1 chairs, but it's not a fencepost error.

Fencepost errors come from counting things rather than the spaces

between them, or vice versa, or by neglecting to consider whether

one should count one or both ends of a row. 2. [rare] An error

induced by unexpected regularities in input values, which can

(for instance) completely thwart a theoretically efficient binary

tree or hash table implementation. (The error here involves the

difference between expected and worst case behaviors of an

algorithm.)

Node:fiber-seeking backhoe,

Next:FidoNet, Previous:fencepost error, Up:= F =

fiber-seeking backhoe

[common among backbone ISP personnel] Any of a genus of large,

disruptive machines which routinely cut critical backbone links,

creating Internet outages and packet over air problems.

The Jargon File, Version 4.2.2, 20 Aug 2000 · 第 627 / 1941 题