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

Re: Status of Mac OS/X ports of git and cogito?

From
Linus Torvalds <torvalds@osdl.org>
Date
Sep 11, 2005, 23:40 UTC
Message-ID
<Pine.LNX.4.58.0509111631500.3242@g5.osdl.org>
In-Reply-To
<Pine.LNX.4.63.0509120119120.10594@wgmdd8.biozentrum.uni-wuerzburg.de>
On Mon, 12 Sep 2005, Johannes Schindelin wrote:
Show 5 quoted lines
>
> Linus, we all know that you are always right. Only that in this case you 
> are just a little bit less right than usual. The introduction of this 
> typedef was a sane thing to do, for the same reason it is a sane thing to 
> use sensible variable names: documentation.
Nope.
Go through the history of that thing.
It wasn't introduced as "socklen_t". It was introduced as "size_t".
That was so horribly wrong that it's not even funny. 

Documentation my ass. It's a matter of people thinking that the old portable types aren't good enough, and that you have to make up new names for everything in order to allow "portability" where different systems have different ideas.

And it's ignoring the fact that true portability means "it just works". "size_t" fundamentally didn't work.

And the really sad part is that before the standards bodies started messing around with it, things really _did_ "just work". There was no question at all about what kind of type to use.

These days, we sadly have some systems that just blindly followed the standard, changed "int" to "size_t", and then when the standard was fixed, changed "socklen_t" to be "size_t".

Don't believe me? Just google for "size_t" and "socklen_t", and weep.
All this confusion, and for what? Absolutely _zero_ upsides.

Basically, if a programmer feels like he needs to remind himself what the variable was all about, how about using descriptive variable names? I claim that

	int addr_len;
is a lot more documentation than
	socklen_t len;

and that the people who think that different type-name are "documentation" are ignoring the fact that they are _also_ "confusing".

There's a virtue in simplicity. Abstraction is _not_ a virtue.
			Linus
Previous: Johannes SchindelinNext: Linus Torvalds
Message 14 of 22 in “Status of Mac OS/X ports of git and cogito?”
  1. John EllsonAug 27, 2005
  2. Junio C HamanoAug 27, 2005
  3. Johannes SchindelinSep 11, 2005
  4. Martin LanghoffSep 11, 2005
  5. Johannes SchindelinSep 11, 2005
  6. Junio C HamanoSep 11, 2005
  7. Linus TorvaldsSep 11, 2005
  8. A Large Angry SCMSep 11, 2005
  9. Junio C HamanoSep 11, 2005
  10. Johannes SchindelinSep 11, 2005
  11. Linus TorvaldsSep 11, 2005
  12. Use int instead of socklen_tJunio C Hamano, Sep 11, 2005
  13. Johannes SchindelinSep 11, 2005
  14. Linus TorvaldsSep 11, 2005
  15. Linus TorvaldsSep 11, 2005
  16. Johannes SchindelinSep 12, 2005
  17. Daniel BarkalowSep 11, 2005
  18. Martin LanghoffSep 11, 2005
  19. Johannes SchindelinSep 11, 2005
  20. Martin LanghoffAug 27, 2005
  21. Martin LanghoffAug 29, 2005
  22. Martin LanghoffAug 30, 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.