On Saturday, 13 September 2014 at 21:46:45 UTC, Andrei
Alexandrescu wrote:
No, it's all eager copy. std::string is thoroughly botched. A
good
inexpensive lesson for us. -- Andrei
I mean possible lifetime management options are:
1. string
2. string*
3. shared_ptrstring
4. weak_ptrstring
5.
Am 14.09.2014 10:27, schrieb Kagamin:
On Saturday, 13 September 2014 at 21:46:45 UTC, Andrei Alexandrescu wrote:
No, it's all eager copy. std::string is thoroughly botched. A good
inexpensive lesson for us. -- Andrei
I mean possible lifetime management options are:
1. string
2. string*
3.
I mean possible lifetime management options are:
1. string
2. string*
3. shared_ptrstring
4. weak_ptrstring
5. unshared_ptrstring (not interlocked; does something like
this exist?)
This way string is just like any other object. It's C++ after
all, the foot must be shot.
Exactly, you can
Am 14.09.2014 16:19, schrieb po:
...
6. string::c_str() (let char* botch string internals)
It returns a const char* so you would have to cast const away to do that--
Which everyone does all the time, because the main reason c_str() exists
is to interface with C style APIs, most of them
On 9/14/14, 1:27 AM, Kagamin wrote:
On Saturday, 13 September 2014 at 21:46:45 UTC, Andrei Alexandrescu wrote:
No, it's all eager copy. std::string is thoroughly botched. A good
inexpensive lesson for us. -- Andrei
I mean possible lifetime management options are:
1. string
2. string*
3.
Smart pointers are rarely used, most C++ stuff is done by
value.
Strings too?
Two string types are used.
-std::string type: by value, has smaller buffer optimization,
used at startup/logging, and for any dynamic strings with
unbounded possible values
-immutable string handles: by value.
On Saturday, 13 September 2014 at 12:05:59 UTC, po wrote:
Smart pointers are rarely used, most C++ stuff is done by
value.
Strings too?
Two string types are used.
-std::string type: by value, has smaller buffer optimization,
used at startup/logging, and for any dynamic strings with
Are you sure? From basic_string.h:
_CharT*
_M_refcopy() throw()
{
#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
if (__builtin_expect(this != _S_empty_rep(), false))
#endif
__gnu_cxx::__atomic_add_dispatch(this-_M_refcount, 1);
return
On 9/13/14, 9:13 AM, Kagamin wrote:
On Saturday, 13 September 2014 at 12:05:59 UTC, po wrote:
Smart pointers are rarely used, most C++ stuff is done by value.
Strings too?
Two string types are used.
-std::string type: by value, has smaller buffer optimization, used at
startup/logging, and
On Saturday, 13 September 2014 at 19:34:10 UTC, Andrei
Alexandrescu wrote:
C++11 makes all refcounting implementations of std::string
illegal. -- Andrei
#facepalm
On Saturday, 13 September 2014 at 19:34:10 UTC, Andrei
Alexandrescu wrote:
C++11 makes all refcounting implementations of std::string
illegal. -- Andrei
Ah, so lifetime management can be rolled on top of string if
needed? Hmm... makes sense.
Kagamin s...@here.lot wrote:
On Saturday, 13 September 2014 at 19:34:10 UTC, Andrei Alexandrescu wrote:
C++11 makes all refcounting implementations of std::string illegal. --
Andrei
Ah, so lifetime management can be rolled on top of string if needed? Hmm...
makes sense.
No, it's all
On 11/09/14 21:02, eles wrote:
Could you provide one or two short but illustrative examples in Tango
and Phobos showing the howto and the why not in Phobos?
Tango:
import tango.text.Unicode;
void foo ()
{
char[3] result; // pre-allocate buffer on the stack
auto b =
V Fri, 12 Sep 2014 08:47:55 +0200
Jacob Carlborg via Digitalmars-d digitalmars-d@puremagic.com napsáno:
On 11/09/14 21:02, eles wrote:
Could you provide one or two short but illustrative examples in
Tango and Phobos showing the howto and the why not in Phobos?
Tango:
import
On Thursday, 11 September 2014 at 19:56:17 UTC, Paulo Pinto wrote:
Am 11.09.2014 20:32, schrieb Daniel Alves:
It is incredible how Objective-C's ARC became a symbol for
reference counting, instead of the living proof of Apple's
failure to produce
a working GC for Objective-C that didn't
On Thursday, 11 September 2014 at 20:11:45 UTC, deadalnix wrote:
On Thursday, 11 September 2014 at 12:38:54 UTC, Andrey Lifanov
wrote:
- Other memory management technique require bookkeeping. In a
multicore environment, that mean expensive synchronization.
It is also true that when you
On Friday, 12 September 2014 at 06:47:56 UTC, Jacob Carlborg
wrote:
On 11/09/14 21:02, eles wrote:
Thank you. Basically, it is about a different interface of the
functions, something like the difference between new and
placement new.
This could be added to Phobos too, through those
On Friday, 12 September 2014 at 07:49:59 UTC, eles wrote:
On Thursday, 11 September 2014 at 20:11:45 UTC, deadalnix wrote:
- Other memory management technique require bookkeeping. In a
multicore environment, that mean expensive synchronization.
It is also true that when you start to really
On Friday, 12 September 2014 at 08:27:55 UTC, Dominikus Dittes
Scherkl wrote:
On Friday, 12 September 2014 at 07:49:59 UTC, eles wrote:
On Thursday, 11 September 2014 at 20:11:45 UTC, deadalnix
wrote:
May be, but this complexity is hidden
The old question: at what cost?
There is always a
programmers who really have this stuff down... how much of your
code and your mental energy with C++ is spent on memory
ownership rules? Is it really a productive use of your time?
Does the program materially benefit from the design required to
make it safe, correct, and self-documenting
On Fri, 12 Sep 2014 07:49:57 +
eles via Digitalmars-d digitalmars-d@puremagic.com wrote:
Remember, what people like in C is inclusively the shoot the
foot simplicity and availability. If you want it, you do it.
but you can shoot yourself in the foot in D! you can run around in
circles
On 12/09/14 08:59, Daniel Kozak via Digitalmars-d wrote:
toUpperInPlace could help little, but still not perfect
Converting text to uppercase doesn't work in-place in some cases. For
example the German double S will take two letters in uppercase form.
--
/Jacob Carlborg
On 12/09/14 09:58, eles wrote:
On Friday, 12 September 2014 at 06:47:56 UTC, Jacob Carlborg wrote:
On 11/09/14 21:02, eles wrote:
Thank you. Basically, it is about a different interface of the
functions, something like the difference between new and placement new.
This could be added to
On Friday, 12 September 2014 at 07:46:03 UTC, eles wrote:
On Thursday, 11 September 2014 at 19:56:17 UTC, Paulo Pinto
wrote:
Am 11.09.2014 20:32, schrieb Daniel Alves:
It is incredible how Objective-C's ARC became a symbol for
reference counting, instead of the living proof of Apple's
On Friday, 12 September 2014 at 12:39:51 UTC, Paulo Pinto wrote:
On Friday, 12 September 2014 at 07:46:03 UTC, eles wrote:
On Thursday, 11 September 2014 at 19:56:17 UTC, Paulo Pinto
wrote:
Am 11.09.2014 20:32, schrieb Daniel Alves:
ARC was a term popularized by Apple when they introduced
On Friday, 12 September 2014 at 08:50:17 UTC, po wrote:
But using modern C++11/14 + TBB it really isn't hard at all.
It is fairly trivial to scale to N cores using a task based
approach. Smart pointers are rarely used, most C++ stuff is
done by value.
Strings too?
For instance, I work on
Am Fri, 12 Sep 2014 13:45:45 +0200
schrieb Jacob Carlborg d...@me.com:
On 12/09/14 08:59, Daniel Kozak via Digitalmars-d wrote:
toUpperInPlace could help little, but still not perfect
Converting text to uppercase doesn't work in-place in some cases. For
example the German double S will
Am Thu, 11 Sep 2014 13:44:09 +
schrieb Adam D. Ruppe destructiona...@gmail.com:
On Thursday, 11 September 2014 at 12:38:54 UTC, Andrey Lifanov
wrote:
And I think of idea of complete extraction of GC from D.
You could also recompile the runtime library without the GC.
Heck, with the
On Thursday, 11 September 2014 at 20:55:43 UTC, Andrey Lifanov
wrote:
Everyone tells about greatness and safety of GC, and that it is
hard to live without it... But, I suppose, you all do know the
one programming language in which 95% of AAA-quality popular
desktop software and OS is written.
On Friday, 12 September 2014 at 12:39:51 UTC, Paulo Pinto wrote:
On Friday, 12 September 2014 at 07:46:03 UTC, eles wrote:
On Thursday, 11 September 2014 at 19:56:17 UTC, Paulo Pinto
wrote:
Am 11.09.2014 20:32, schrieb Daniel Alves:
It is incredible how Objective-C's ARC became a symbol for
Am Fri, 12 Sep 2014 15:43:14 +
schrieb Chris wend...@tcd.ie:
[Caveat: I'm no expert]
I once read a manual that explained the GC in Objective-C (years
ago). It said that some objects never get collected although
they're dead, but the garbage collector can no longer reach them.
But maybe
On Friday, 12 September 2014 at 20:41:53 UTC, Marco Leise wrote:
Am Fri, 12 Sep 2014 15:43:14 +
schrieb Chris wend...@tcd.ie:
With only ARC, if two objects reference each other, they keep
each other alive indefinitely unless one of the references is a
weak reference, which doesn't count
Am 13.09.2014 01:52, schrieb eles:
On Friday, 12 September 2014 at 20:41:53 UTC, Marco Leise wrote:
Am Fri, 12 Sep 2014 15:43:14 +
schrieb Chris wend...@tcd.ie:
With only ARC, if two objects reference each other, they keep
each other alive indefinitely unless one of the references is a
You can also help with allocators design:
http://forum.dlang.org/thread/lji5db$30j3$1...@digitalmars.com
The current idea is to add @nogc attribute to functions in
phobos, which can live without GC, so that you could use them
from other @nogc functions.
On Thursday, 11 September 2014 at 12:38:54 UTC, Andrey Lifanov
wrote:
Hello everyone! Being a C/C++ programmer I don't understand,
why such language as D (system programming language)
implemented garbage collector as a core feature, not as
additional optional module or library.
I can
On Thursday, 11 September 2014 at 12:38:54 UTC, Andrey Lifanov
wrote:
And I think of idea of complete extraction of GC from D.
You could also recompile the runtime library without the GC.
Heck, with the new @nogc on your main, the compiler (rather than
the linker) should even give you nicish
Thank you for quick response!
I guess I need further investigation and write good tests to
compare C++ and D solutions. The main advantage over GC-language
is that in case of manual memory management I know completely
when and what will be freed or allocated (with the help of smart
On Thu, 11 Sep 2014 15:23:53 +
Andrey Lifanov via Digitalmars-d digitalmars-d@puremagic.com wrote:
is that in case of manual memory management I know completely
when and what will be freed or allocated (with the help of smart
pointers/reference counting, of course).
but you don't. you
I have recently found:
http://en.wikibooks.org/wiki/D_Programming/Garbage_collector/Thoughts_about_better_GC_implementations
Good stuff there.
Am 11.09.2014 14:38, schrieb Andrey Lifanov:
Hello everyone! Being a C/C++ programmer I don't understand, why such
language as D (system programming language) implemented garbage
collector as a core feature, not as additional optional module or
library. I and many other C/C++ programmers prefer
On Thursday, 11 September 2014 at 15:39:26 UTC, ketmar via
Digitalmars-d wrote:
On Thu, 11 Sep 2014 15:23:53 +
Andrey Lifanov via Digitalmars-d digitalmars-d@puremagic.com
wrote:
is that in case of manual memory management I know completely
when and what will be freed or allocated (with
On Thursday, 11 September 2014 at 13:16:07 UTC, Marc Schütz wrote:
On Thursday, 11 September 2014 at 12:38:54 UTC, Andrey Lifanov
wrote:
Hello everyone! Being a C/C++ programmer I don't understand,
why such language as D (system programming language)
implemented garbage collector as a core
Am 11.09.2014 18:02, schrieb Sean Kelly:
On Thursday, 11 September 2014 at 13:16:07 UTC, Marc Schütz wrote:
On Thursday, 11 September 2014 at 12:38:54 UTC, Andrey Lifanov wrote:
Hello everyone! Being a C/C++ programmer I don't understand, why such
language as D (system programming language)
On Thu, 11 Sep 2014 15:54:17 +
Andrey Lifanov via Digitalmars-d digitalmars-d@puremagic.com wrote:
What do you mean? Some sort of memory leak?
no, i meat that predictability is lost there. and with single-linked
lists, for example, freeing list head can take big amount of time too
if the
On 09/11/2014 09:59 AM, ketmar via Digitalmars-d wrote:
On Thu, 11 Sep 2014 15:54:17 +
Andrey Lifanov via Digitalmars-d digitalmars-d@puremagic.com wrote:
What do you mean? Some sort of memory leak?
no, i meat that predictability is lost there. and with single-linked
lists, for
Thank you all for replies!
I'm not saying that GC is evil. I just want to have different
options and more control, when this is required. If D offered
such choice, many good C++ programmers would have certainly
considered D as a perfect alternative to C++.
D states that there is no strict
You know, currently I spend most of my time programming in ObjC,
but I really love C, C++ and D.
Since the Clang Compiler, ObjC dropped the GC entirely. Yes,
that's right, no GC at all. And, in fact, it does support
concurrent programming and everything else. The magic behind it
is ARC -
On Thu, 11 Sep 2014 18:04:05 +
Andrey Lifanov via Digitalmars-d digitalmars-d@puremagic.com wrote:
Thank you all for replies!
I'm not saying that GC is evil. I just want to have different
options and more control, when this is required. If D offered
such choice
but D *is* offering
On Thu, 11 Sep 2014 18:32:09 +
Daniel Alves via Digitalmars-d digitalmars-d@puremagic.com wrote:
compiler analyzes your code, figures out object scopes and sets
the correct calls to retain/release/autorelease
this *is* GC. it's just hidden behind compiler magic and can't be
changed without
On Thursday, 11 September 2014 at 18:32:10 UTC, Daniel Alves
wrote:
You know, currently I spend most of my time programming in
ObjC, but I really love C, C++ and D.
Since the Clang Compiler, ObjC dropped the GC entirely. Yes,
that's right, no GC at all. And, in fact, it does support
On Thursday, 11 September 2014 at 18:32:10 UTC, Daniel Alves
wrote:
You know, currently I spend most of my time programming in
ObjC, but I really love C, C++ and D.
Since the Clang Compiler, ObjC dropped the GC entirely. Yes,
that's right, no GC at all. And, in fact, it does support
On Thursday, 11 September 2014 at 16:02:31 UTC, Sean Kelly wrote:
On Thursday, 11 September 2014 at 13:16:07 UTC, Marc Schütz
wrote:
On Thursday, 11 September 2014 at 12:38:54 UTC, Andrey Lifanov
wrote:
hidden allocations anywhere. And it's completely possible with
Tango to write an
On Thursday, 11 September 2014 at 16:02:31 UTC, Sean Kelly wrote:
On Thursday, 11 September 2014 at 13:16:07 UTC, Marc Schütz
wrote:
On Thursday, 11 September 2014 at 12:38:54 UTC, Andrey Lifanov
wrote:
Hello everyone! Being a C/C++ programmer I don't understand,
why such language as D (system
On Thursday, 11 September 2014 at 19:14:42 UTC, Marc Schütz wrote:
On Thursday, 11 September 2014 at 16:02:31 UTC, Sean Kelly
wrote:
On Thursday, 11 September 2014 at 13:16:07 UTC, Marc Schütz
wrote:
On Thursday, 11 September 2014 at 12:38:54 UTC, Andrey
Lifanov wrote:
Hello everyone! Being a
Am 11.09.2014 20:32, schrieb Daniel Alves:
You know, currently I spend most of my time programming in ObjC, but I
really love C, C++ and D.
Since the Clang Compiler, ObjC dropped the GC entirely. Yes, that's
right, no GC at all. And, in fact, it does support concurrent
programming and
On Thursday, 11 September 2014 at 12:38:54 UTC, Andrey Lifanov
wrote:
Hello everyone! Being a C/C++ programmer I don't understand,
why such language as D (system programming language)
implemented garbage collector as a core feature, not as
additional optional module or library. I and many
Everyone tells about greatness and safety of GC, and that it is
hard to live without it... But, I suppose, you all do know the
one programming language in which 95% of AAA-quality popular
desktop software and OS is written. And this language is C/C++.
How do you explain this? Just because we
On Thu, 11 Sep 2014 20:55:42 +
Andrey Lifanov via Digitalmars-d digitalmars-d@puremagic.com wrote:
Everyone tells about greatness and safety of GC, and that it is
hard to live without it... But, I suppose, you all do know the
one programming language in which 95% of AAA-quality popular
On Thursday, 11 September 2014 at 20:55:43 UTC, Andrey Lifanov
wrote:
Every experienced programmer can easily handle parallel
programming and memory management in C++.
Eliminate parallel programming from that statement and I could
be convinced to believe you, though after years of diagnosing
On Thursday, 11 September 2014 at 20:55:43 UTC, Andrey Lifanov
wrote:
Everyone tells about greatness and safety of GC, and that it is
hard to live without it... But, I suppose, you all do know the
one programming language in which 95% of AAA-quality popular
desktop software and OS is written.
61 matches
Mail list logo