Well, then we're going to have to agree to disagree on that
one. While some
design decisions may have made more sense at the time they were
made or the
ultimate pros and cons may not have been clear at the time, I
think that zero-
terminated strings are one of the design decisions which was
tru
On Friday, July 06, 2012 12:56:36 Wouter Verhelst wrote:
> However, I also happen
> to think that saying "zero-terminated strings were a horrendous design
> decision" is a bit short-sighted.
Well, then we're going to have to agree to disagree on that one. While some
design decisions may have made
Timon Gehr writes:
> This incurs the cost of determining the original string's length,
There are ways to know the original string's length without having to
calculate it. E.g., if you do a read() with some length and you don't
get an error message indicating that there aren't as many characters
a
Thanks for the lengthy threaded explanations. I just use the
language to write applications, I have no idea of the challenges
that you must face to implement/design a language. Hence the
stupid questions. :) Anyways, fascinating stuff.
On 07/06/2012 03:40 AM, Wouter Verhelst wrote:
Timon Gehr writes:
On 07/06/2012 02:57 AM, Wouter Verhelst wrote:
To be fair, there are a _few_ areas in which zero-terminated strings may
possibly outperform zero-terminated strings (appending data in the case
where you know the memory block is
On Thursday, July 05, 2012 19:59:26 Wouter Verhelst wrote:
> Well, really, strings in C are just a special case of arrays (as is true
> in D as well), and arrays in C are just a special case of pointers
> (which isn't true in D). That means the language is fairly compact,
> which also means the com
Jonathan M Davis writes:
> On Thursday, July 05, 2012 18:57:05 Wouter Verhelst wrote:
>> To be fair, there are a _few_ areas in which zero-terminated strings may
>> possibly outperform zero-terminated strings (appending data in the case
>> where you know the memory block is large enough, for inst
Timon Gehr writes:
> On 07/06/2012 02:57 AM, Wouter Verhelst wrote:
>> To be fair, there are a _few_ areas in which zero-terminated strings may
>> possibly outperform zero-terminated strings (appending data in the case
>> where you know the memory block is large enough, for instance).
>
> It is i
On Thursday, July 05, 2012 18:57:05 Wouter Verhelst wrote:
> Jonathan M Davis writes:
> > On Thursday, July 05, 2012 21:32:11 dcoder wrote:
> >> Thanks for the thorough explanation, but it begs the question why
> >> not make strings be array of chars that have \0 at the end of it?
> >>
> >> Sin
On 07/06/2012 02:57 AM, Wouter Verhelst wrote:
Jonathan M Davis writes:
On Thursday, July 05, 2012 21:32:11 dcoder wrote:
Thanks for the thorough explanation, but it begs the question why
not make strings be array of chars that have \0 at the end of it?
Since, lots of D programmers were/ar
Jonathan M Davis writes:
> On Thursday, July 05, 2012 21:32:11 dcoder wrote:
>> Thanks for the thorough explanation, but it begs the question why
>> not make strings be array of chars that have \0 at the end of it?
>> Since, lots of D programmers were/are probably C/C++
>> programmers, why shou
On Thursday, July 05, 2012 21:32:11 dcoder wrote:
> Thanks for the thorough explanation, but it begs the question why
> not make strings be array of chars that have \0 at the end of it?
> Since, lots of D programmers were/are probably C/C++
> programmers, why should D be different here? Wouldn't
On 07/05/2012 09:32 PM, dcoder wrote:
Thanks for the thorough explanation, but it begs the question why not
make strings be array of chars that have \0 at the end of it?
Because that is inefficient. It disables string slicing and is
completely redundant.
BTW: String literals are guaranteed
On Saturday, 30 June 2012 at 00:27:46 UTC, Jonathan M Davis wrote:
On Saturday, June 30, 2012 02:12:22 mta`chrono wrote:
does anyone know why string not implicit convertable to
const(char*) ?
---
import core.sys.posix.unistd;
void main()
{
// ok
unlink("foo.txt");
Your answers are remarkable elaborated. Thanks for your great effort,
Jonathan!! ;-)
On Saturday, June 30, 2012 02:12:22 mta`chrono wrote:
> does anyone know why string not implicit convertable to const(char*) ?
>
> ---
> import core.sys.posix.unistd;
>
> void main()
> {
> // ok
> unlink("foo.txt");
>
> // failed
> string file = "bar.txt";
>
does anyone know why string not implicit convertable to const(char*) ?
---
import core.sys.posix.unistd;
void main()
{
// ok
unlink("foo.txt");
// failed
string file = "bar.txt";
unlink(file);
}
test.d(10): Error: function core.sys.posix.unistd.unlink
17 matches
Mail list logo