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

Re: [OT] Re: C++ *for Git*

From
Robin Rosenberg <robin.rosenberg.lists@dewire.com>
Date
Sep 23, 2007, 23:10 UTC
Message-ID
<200709240110.59680.robin.rosenberg.lists@dewire.com>
In-Reply-To
<85ejgpkr13.fsf@lola.goethe.zz>
söndag 23 september 2007 skrev David Kastrup:
Show 17 quoted lines
> Dmitry Potapov <dpotapov@nbs-eng.ru> writes:
> 
> > On Sun, Sep 23, 2007 at 09:54:10AM -0700, Linus Torvalds wrote:
> >
> >>  - the stuff C++ *does* have is usually nasty. Implicit
> >>  initializers and destructors and the magic lifetime rules of
> >>  objects etc
> >
> > I am not sure what is wrong with initializers and destructors in
> > C++, but certainly there is no magic lifetime rules in C++, as it is
> > fully determined by the scope.
> 
> It has been some time since I last looked, but the lifetime of objects
> constructed in return statements was a moving target through several
> standards.  The last standard I bothered looking at had the object
> survive until the statement with the function call expression ended:
> quite a strange synchronization point with regard to language design.

The idea is that you should be able to use temporaries by reference and trust them to be valid over function calls end even function returns, so you can write efficient matrix math libraries that do not copy data much while retaining value semantics with overloaded operators. It is a purely practical matter, what actually works and is efficient, not dogmatic language "design".

Earlier versions failed to make up something useful here.
Show 5 quoted lines
> > In fact, other high level languages that use GC have much more
> > unpredictable lifetime rules for objects.
> 
> Mostly objects are alive as long as you can refer to them.  Not really
> complicated.
What could be simpler, besides all static variables.
-- robin
Previous: David KastrupNext: Reece Dunn
Message 31 of 34 in “C++ *for Git*”
  1. Dmitry KakurinSep 22, 2007
  2. David KastrupSep 22, 2007
  3. Johannes SchindelinSep 22, 2007
  4. Marco CostalbaSep 22, 2007
  5. Dmitry KakurinSep 23, 2007
  6. Kyle RoseSep 22, 2007
  7. Miles BaderSep 22, 2007
  8. [OT] Re: C++ *for Git*Kyle Rose, Sep 22, 2007
  9. David KastrupSep 22, 2007
  10. Alex UnleashedSep 22, 2007
  11. Frank LichtenheldSep 23, 2007
  12. David BrownSep 23, 2007
  13. David KastrupSep 23, 2007
  14. Marco CostalbaSep 23, 2007
  15. David KastrupSep 23, 2007
  16. Marco CostalbaSep 23, 2007
  17. Pierre HabouzitSep 23, 2007
  18. Marco CostalbaSep 23, 2007
  19. Nicolas PitreSep 23, 2007
  20. Marco CostalbaSep 23, 2007
  21. David KastrupSep 23, 2007
  22. Marco CostalbaSep 23, 2007
  23. Paul FranzSep 23, 2007
  24. Linus TorvaldsSep 23, 2007
  25. Marco CostalbaSep 23, 2007
  26. David KastrupSep 23, 2007
  27. Marco CostalbaSep 23, 2007
  28. David KastrupSep 23, 2007
  29. Dmitry PotapovSep 23, 2007
  30. David KastrupSep 23, 2007
  31. Robin RosenbergSep 23, 2007
  32. Reece DunnSep 23, 2007
  33. Dmitry PotapovSep 24, 2007
  34. Martin LanghoffSep 22, 2007

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.