At least for the GNU implementation of dc
, there is a hard-coded DEFAULT_LINE_MAX
of 70 characters - although that may be overridden by setting a DC_LINE_LENGTH
environment variable. From dc/numeric.c
:
559 static int out_col = 0;
560 static int line_max = -1; /* negative means "need to check environment" */
561 #define DEFAULT_LINE_MAX 70
562
563 static void
564 set_line_max_from_environment(void)
565 {
566 const char *env_line_len = getenv("DC_LINE_LENGTH");
567 line_max = DEFAULT_LINE_MAX;
568 errno = 0;
569 if (env_line_len) {
570 char *endptr;
571 long proposed_line_len = strtol(env_line_len, &endptr, 0);
572 line_max = (int)proposed_line_len;
573
574 /* silently enforce sanity */
575 while (isspace(*endptr))
576 ++endptr;
577 if (*endptr || errno || line_max != proposed_line_len
578 || line_max < 0 || line_max == 1)
579 line_max = DEFAULT_LINE_MAX;
580 }
581 }
582
So
$ dc
999999999999999999999999999999999999999999999999999999999999999999999999
p
999999999999999999999999999999999999999999999999999999999999999999999\
999
q
but
$ DC_LINE_LENGTH=0 dc
999999999999999999999999999999999999999999999999999999999999999999999999
p
999999999999999999999999999999999999999999999999999999999999999999999999
q
$
dc
being an arbitrary precision calculator, it can give you numbers of arbitrary length, and many tools (including most historical text processing ones), communication channels (think SMTP, or ttys on input) etc. have limits on the maximum line length. So while the 70 one most probably comes from early tty limitations or user convenience, even if at a different length, you'd still want to wrap long lines. Note that POSIX requires that 70 wrapping for bc (which was historically a wrapper around dc) – Stéphane Chazelas Feb 08 '18 at 10:17