From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,effb80d4bb7716dd X-Google-Attributes: gid103376,public From: Robert A Duff Subject: Re: Pointer Arithmetic (was: Wanted: Ada STL....) Date: 1999/02/03 Message-ID: #1/1 X-Deja-AN: 440273299 Sender: bobduff@world.std.com (Robert A Duff) References: <790f4q$3l@bgtnsc01.worldnet.att.net> <797na3$obg$1@nnrp1.dejanews.com> <798lej$69d$1@plug.news.pipex.net> <799f5t$7je$1@nnrp1.dejanews.com> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1999-02-03T00:00:00+00:00 List-Id: robert_dewar@my-dejanews.com writes: > The design of C in general is effective in allowing the > user to do some optimization when using a completely stupid > compiler that does no optimization at all. For example, the > register declaration is in this category. True, but to be fair, both compiler and hardware technology have changed somewhat since C was designed. > But with a modern optimizing compiler, the excessively low ^^^^^^ > level of C code (in particular its over-reliance on > explicit pointers) is counter productive Indeed. >... (it is interesting > to note that most modern optimizing C compilers simply > ignore the register declaration, they can do a better job > than the programmer of figuring out what to keep in > registers), but these same optimizing compilers cannot undo > the (mis)use of pointer arithmetic for, e.g. array > referencing. True for locals and parameters. I know of a couple of modern C compilers that obey the "register" keyword when the variable is not local to a function. This can be an efficiency win in some kinds of programs. - Bob -- Change robert to bob to get my real email address. Sorry.