K&R 5-11 ( a little OT)

M

mdeh

Hi all,
May I ask this before I dive into this exercise which deals with Tabs.

Given a "tab stop" of , for example 8.

Does this mean that at every multiple of 8, a character would be
printed if that tab stop were chosen.

So, with the cursor at the beginning of a new line, and a "Tab Tab 'm'
", 'm' would be in the 16th column ( or be the 16th character?)

Thanks.
 
W

Walter Roberson

mdeh said:
May I ask this before I dive into this exercise which deals with Tabs.
Given a "tab stop" of , for example 8.
Does this mean that at every multiple of 8, a character would be
printed if that tab stop were chosen.

Not exactly. A tab stop is defined only for a particular position.
If you say that you have "a tab stop of 8", then column 8 is the
only column thereby specified as having a stop.

It is not completely uncommon for people to specify that there
is a tab stop "every" 8, which would be closer to the situation
you describe.

Though, keep in mind that you might tab to somewhere and then
proceed with some other kind of whitespace such as spaces.
Semantically, most people would say that if there is a space
at column 8, that no character has been "printed" there.

Tab stops indicate where forward tab motion would end. What happens
after that depends upon what gets output at that point.

So, with the cursor at the beginning of a new line, and a "Tab Tab 'm'
", 'm' would be in the 16th column ( or be the 16th character?)

In that case, 'm' would be the third character, and would show up
in the 16th column.
 
M

mdeh

Not exactly. A tab stop is defined only for a particular position.
If you say that you have "a tab stop of 8", then column 8 is the
only column thereby specified as having a stop.

OK...


In that case, 'm' would be the third character, and would show up
in the 16th column.

Thank you.
 
T

Thad Smith

Walter said:
In that case, 'm' would be the third character, and would show up
in the 16th column.

In my editor, with a tab stop every 8th position, it would be in the
17th column. I think that would be true of most "tab every Nth"
implementations.
 
M

mdeh

In my editor, with a tab stop every 8th position, it would be in the
17th column. I think that would be true of most "tab every Nth"
implementations.

Does this mean a Tab is a single character that occupies a varying
number of bytes which will bring it to the next Tab Stop. So, the next
character will occupy the first byte? after the stop. ( In a single
byte language?)
 
R

Richard Tobin

mdeh said:
Does this mean a Tab is a single character that occupies a varying
number of bytes which will bring it to the next Tab Stop.

No, it occupies a varying length on the screen or paper. With a
fixed-width font, you could say it occupies a varying number of
display positions. It's the output device that interprets it. Bytes
don't come into it at all.

-- Richard
 
M

mdh

No, it occupies a varying length on the screen or paper. With a
fixed-width font, you could say it occupies a varying number of
display positions. It's the output device that interprets it. Bytes
don't come into it at all.


Thanks for clarifying.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,436
Messages
2,571,696
Members
48,796
Latest member
Greg L.
Top