git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
David A. Wheeler <dwheeler@dwheeler.com>
Date
Apr 25, 2005, 18:06 UTC
Message-ID
<426D319B.2040805@dwheeler.com>
In-Reply-To
<426CD703.5040009@exactcode.de>
Rene Rebe wrote:
Show 12 quoted lines
> Hi,
>
> Matthias-Christian Ott wrote:
>
>> The "git" didn't try store small variables, which aren't referenced, 
>> in the processor registers. It also didn't use the size_t type. I 
>> corrected a C++ style comment too.
>
>
> Well, modern compilers take register as a non-binding hint. Your 
> register storage specification for those loop counters will not make 
> any change. You have not looked into the resulting binary?

Indeed, register was ALWAYS a non-binding hint. Today, unless you have specific measurements showing that adding "register" at some point improves the performance for a (somewhat common) situation, you're better off NOT including "register" nowadays. Today's compilers are generally better at allocating registers than people-who-have-little-time. Premature optimization is the root of all kinds of evil...

> Also // is valid C99 ...

It's not, strictly speaking, okay on old pre-C99 compilers. But in practice, practically all C compilers from the last 10+ years have accepted // comments as a very popular extension. So using "//" is unlikely to be a portability problem, even on semi-old compilers.

--- David A. Wheeler
Previous: Matthias-Christian OttNext: Petr Baudis
Message 5 of 21 in “make use of register variables & size_t”
  1. make use of register variables & size_tMatthias-Christian Ott, Apr 25, 2005
  2. Rene RebeApr 25, 2005
  3. Matthias-Christian OttApr 25, 2005
  4. Matthias-Christian OttApr 25, 2005
  5. David A. WheelerApr 25, 2005
  6. Petr BaudisApr 25, 2005
  7. Pekka EnbergApr 25, 2005
  8. Linus TorvaldsApr 25, 2005
  9. Matthias-Christian OttApr 25, 2005
  10. Jan-Benedict GlawApr 25, 2005
  11. Thomas GlanzmannApr 25, 2005
  12. Jan-Benedict GlawApr 25, 2005
  13. Matthias-Christian OttApr 25, 2005
  14. valdis.kletnieks@vt.eduApr 25, 2005
  15. Linus TorvaldsApr 25, 2005
  16. Matthias-Christian OttApr 25, 2005
  17. Linus TorvaldsApr 25, 2005
  18. Arjan van de VenApr 25, 2005
  19. valdis.kletnieks@vt.eduApr 25, 2005
  20. Brian O'MahoneyApr 25, 2005
  21. Dmitry TorokhovApr 25, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.