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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



söndag 23 september 2007 skrev David Kastrup:
> Dmitry Potapov <dpotapov@xxxxxxxxxx> 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.

> > 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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux