Help in this programm in C

K

Keith Thompson

Bill Pursell said:
No. The person who wrote the code should write it so
that things align properly regardless of the tabstop setting.
This is not difficult to do, and is only hampered by dogmatic
assertions that one must use only spaces. However,
if the author of the code failed to indent properly, you don't
reconfigure the editor, you merely reconfigure the session.
It is hardly difficult to type
:set ts=4

I don't know what is involved in changing the tabstop in
other editors, but I gather it is extremely difficult, given
that the great majority of persons I encounter don't know
how to do it.

Yes, it's easy to type

:set ts=4

in vi (which happens to be the editor I normally use). Should I also
find out how to change the tabstop setting in my newsreader? My
pager? My web browser? My printer? My terminal emulator (if the
source is short enough for "cat foo.c")?

If I need to look at code that is legible only with 4-column tabstops,
I'm more likely to filter it through "expand -t 4" -- once I figure
out that 4 is the magic number, which probably won't be immediately
obvious. And then I'll wonder why the author didn't do this in the
first place -- or at least use the 8-column tabstops that are the
default in every piece of software I've ever used. (No doubt there
are counterexamples.)

Note that tabstop settings and indentation levels aren't necessarily
tied together. Before I started avoiding tabs altogether (<OT>except
in Makefiles -- sigh</OT>), I typically used 2-, 3-, or 4-column
indentation and 8-column tabstops; my editor, vi, handles this almost
transparently.
 
R

Richard Bos

Dann Corbit said:
I would add strtok(), which is hopelessly broken. The POSIX strtok_r() is
the correct way to write a simple token parser.

I wouldn't. strtok() is very easy to misuse, but it _can_ be used
correcly. Usually, you're right, there are much better functions
(although I would not use strtok_r() unless I were already tied to POSIX
anyway - replacements for strtok() aren't that hard to write yourself,
in clean ISO C); but the option in question is for functions that are
irredeemably dangerous, not just a pain in the neck.
Anyway, I _have_ found strtok() useful. Just the once, IIRC, and the
circumstances now escape my memory, but that one time, strtok()
sufficed.

Richard
 
D

Dave Thompson

Skarmander wrote:

It is still in XP and I believe unchanged.
<OT> NT/2k/XP notepad does not have the 64K limit.

I know from experience* it will happily try to slurp a file over 500MB
and (on the machine I was using then) swap for about half an hour
before completing that task.

* experience = the result of making a mistake. In this case I didn't
notice how big the log file, normally a few MB, had gotten.

- David.Thompson1 at worldnet.att.net
 
D

Dave Thompson

This isn't correct. You can put two characters into single quotes. You'll
need to do printf ("\n\n"), two puts("") or two putchar ('\n').
Presumably you meant can't. In fact, the standard allows multiple
characters in a 'character constant' but the resulting value is
implementation-defined, and extremely likely to not produce what was
apparently desired here, although reasonably likely to produce a
single newline, which IMHO would actually be just fine here.

<snip much else>

- David.Thompson1 at worldnet.att.net
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top