Indentation and braces

gordon at sneaky gordon at sneaky
Sat May 31 13:15:00 AEST 1986


> ...
> However, if indentation always reflects your intention, then eliminating the
> braces and making indentation significant would prevent this type of bug in
> the first place!
> 
> Karl W. Z. Heuer (ihnp4!bentley!kwh), The Walking Lint

Does anyone have an ANSI standard for where you're supposed to set your
tab stops?  Determining "amount of indentation" from the whitespace
characters in the source isn't that straightforward.  Try ordering
these sequences of leading white space (presumed to be preceeded by
a newline or the beginning of the file, and followed by a statement) 
by "amount of indentation", without having to supply information 
to the compiler about what kind of terminal the source was written for
(which isn't usually, of course, the same as the terminal, if any, you 
are running the compilation from):

9 spaces
2 tabs
15 spaces
16 spaces
17 spaces
1 space, 2 tabs
3 tabs
5 spaces, tab, 1 space, tab
3 spaces, formfeed, 3 spaces, tab, tab
3 spaces, formfeed, 15 spaces
formfeed, 15 spaces
2,000 spaces, formfeed, 6 spaces
7 spaces, tab, 7 spaces, tab
2 tabs, 1 space
4 spaces, tab, 4 spaces, tab 
null string (statement starts in first character of the line)
formfeed

Is control-K (VT) defined as white space?  If so, you get more interesting
and confusing combinations.

Your terminal's tabs ARE set at column (left edge = column 1) 7, 15, 30, 
and 72, aren't they?  :-)

Do tabs expand relative to the edge of the terminal, or the edge of the
window the compiler is running in?  What happens if the window changes
during compilation?

				Gordon Burditt
				...!convex!ctvax!trsvax!sneaky!gordon



More information about the Comp.lang.c mailing list