Re: [PATCH GIT 0.6] make use of register variables & size_t

From: Horst von Brand
Date: Mon Apr 25 2005 - 12:52:50 EST


Matthias-Christian Ott <matthias.christian@xxxxxxxxxx> said:
> [Proposed patch adding "register" snipped]

Somebody a long while ago told me there are 3 kinds of C compilers with
respect "register": Dumb ones (they don't even consider it, just do
business as usual, as they don't know any better), normal ones (they
consider "register" and honor it if they can), and bright ones (they don't
even consider it, as they do a much better job using registers than any
programmer could direct them to by wiring a value into a register). GCC
definitely falls on the brighter side, at least if you tell it to
optimize. I think "register" should be marked deprecated in C (and there
are few good texts that even mention the word today, so it is deprecated in
practice).

Better compare the code produced (with -S instead of -c you'll get
assembler output in .s, not object code in .o) before any optimization
proposal. But also consider that large real gains come from higher-level
changes (better data structures, more efficient algorithms) and not from
low-level changes (In any case, today's compilers are usually smart enough
to make low-level changes on their own, so you can (thankfully) concentrate
on writing clear, correct code; and let the compiler make it fast. Sure,
where it is in a stretch of hot code, executed hundereds of times a second
on millions of machines worldwide, extra loving care is warranted, but that
is another kettle of fish.).
--
Dr. Horst H. von Brand User #22616 counter.li.org
Departamento de Informatica Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria +56 32 654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/