From: | preston@cs.rice.edu (Preston Briggs) |
Newsgroups: | comp.compilers |
Date: | 17 Mar 1996 23:20:47 -0500 |
Organization: | Rice University |
References: | 96-03-006 96-03-091 96-03-106 |
Keywords: | C, performance |
Christopher Glaeser <cdg@nullstone.com> wrote:
>1) const - Granted, const is useful in situations where you want to
>inhibit stores and isolate potential errors at compile time. However,
>using const as a replacement for constant macros has performance
>penalties for many C compilers.
>2) static - Static can cause significant performance problems for many
>C compilers.
I have no doubts that Glaeser is correct, but I find this implied goal
of programming to the lowest common denominator very depressing. I'd
much prefer to see code written as cleanly as possible, using the
language as it should be used, not in a way dictated by the worst
compilers extant. If you're using a compiler that has such problems
(with const, say), you probably shouldn't expect much in the way of
performance no matter how carefully you contort your code.
If you buy a compiler that's supposed to generate good code, then you
should complain bitterly if it doesn't. Or buy from another source.
Or write your own.
Preston Briggs
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.