delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/10/11:15:52

Date: Mon, 10 Apr 2000 17:29:15 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Richard Slobod <71231 DOT 104 AT compuserve DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: Bracketing: A Matter of Style
In-Reply-To: <38f1d0b8.378303846@news.warwick.net>
Message-ID: <Pine.SUN.3.91.1000410172457.24866I@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Mon, 10 Apr 2000, Richard Slobod wrote:

> Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> wrote:
> 
> >You took a trivial example.  Try a real-life program, and you'll see
> >what I mean.  The problem happens because indentation uses blanks and
> >spaces together.  Tabs change their size, but blanks don't.
> 
> Huh?  If you indent with tabs, then you indent with tabs, not a mixture of
> tabs and spaces.

It depends on the indenting style.  If every indentation level is 2 
columns deep, then the 4th level will use a tab, the 5th will use a tab 
and a space, etc.

Using a tab for each level wastes the line width too quickly, IMHO.

> Could you post an example of what you're talking about?

This is from the DJGPP library (file name fflush.c):

/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <libc/stubs.h>
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <unistd.h>
#include <libc/file.h>
#include <io.h>

int
fflush(FILE *f)
{
  char *base;
  int n, rn;

  if (f == NULL)
  {
    int e = errno;

    errno = 0;
    _fwalk((void (*)(FILE *))fflush);
    if (errno)
      return EOF;
    errno = e;
    return 0;
  }

  f->_flag &= ~_IOUNGETC;
  if ((f->_flag&(_IONBF|_IOWRT))==_IOWRT
      && (base = f->_base) != NULL
      && (rn = n = f->_ptr - base) > 0)
  {
    f->_ptr = base;
    f->_cnt = (f->_flag&(_IOLBF|_IONBF)) ? 0 : f->_bufsiz;
    do {
      /* If termios hooked this handle, call the termios hook.
	 We only do this with handles marked by putc and fwrite,
	 to prevent double conversion of NL to CR-LF and avoid
	 messing up the special termios conversions the user
	 might have requested for CR and NL.  */
      if ((f->_flag & _IOTERM) == 0
	  || __libc_write_termios_hook == NULL
	  || __libc_write_termios_hook(fileno(f), base, rn, &n) == 0)
	n = _write(fileno(f), base, rn);
      if (n <= 0) {
	f->_flag |= _IOERR;
	return EOF;
      }
      rn -= n;
      base += n;
    } while (rn > 0);
  }
  if (f->_flag & _IORW)
  {
    f->_cnt = 0;
    f->_flag &= ~(_IOWRT|_IOREAD);
    f->_ptr = f->_base;
  }
  return 0;
}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019