www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/27/20:00:17

From: Endlisnis <s257m AT unb DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Optimizations
Date: Sun, 27 Sep 1998 20:06:22 -0300
Organization: BrunNet
Lines: 24
Message-ID: <360EC4EE.52F3BE6E@unb.ca>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 980920103551 DOT 406H-100000 AT is> <3606914B DOT 62A6 AT erols DOT com>
NNTP-Posting-Host: usr3fton42.brunnet.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

John S. Fine wrote:

> > One thing that sometimes helps in C is to explicitly tell the compiler
> > that the functions called inside the loop have no side effects, by
> > declaring it with __attribute__((const)).  This is described in GCC docs,
> > and sometimes has a dramatic effect on code generated for loops that call
> > functions.
>   All of my routines in the entire project have side effects.

    I hope you don't take this the wrong way (and you undoubtably will), but I
would call that bad programming structure.  Side effects are bad things.  There
are some times when they are hard (or impossible) to avoid, but attempts should
be made.  That's one of the big ideas behind Object oriented programming.  It
divides data which needs to be accessed by many programs into logical chunks
that can only be accessed by the required functions.

--
     (\/) Endlisnis (\/)
          s257m AT unb DOT ca
          Endlisnis AT GeoCities DOT com
          Endlisnis AT BrunNet DOT Net



- Raw text -


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