<div class="gmail_quote">On Wed, May 16, 2012 at 6:10 PM, Alex Rønne Petersen <span dir="ltr"><<a href="mailto:alex@lycus.org" target="_blank">alex@lycus.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 16-05-2012 16:04, Gor Gyolchanyan wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
On Wed, May 16, 2012 at 5:25 PM, Steven Schveighoffer<br></div><div class="im">
<<a href="mailto:schveiguy@yahoo.com" target="_blank">schveiguy@yahoo.com</a> <mailto:<a href="mailto:schveiguy@yahoo.com" target="_blank">schveiguy@yahoo.com</a>>> wrote:<br>
<br>
On Tue, 15 May 2012 18:31:26 -0400, deadalnix <<a href="mailto:deadalnix@gmail.com" target="_blank">deadalnix@gmail.com</a><br></div><div><div class="h5">
<mailto:<a href="mailto:deadalnix@gmail.com" target="_blank">deadalnix@gmail.com</a>>> wrote:<br>
<br>
Le 15/05/2012 17:51, Christophe a écrit :<br>
<br>
deadalnix , dans le message (digitalmars.D:167404), a écrit :<br>
<br>
This looks to me like a bad practice. C string and D<br>
string are<br>
different beasts, and we have toStringz .<br>
<br>
<br>
C string and D string are different, but it's not a bad idea<br>
to have<br>
string *literals* that works for both C and D strings,<br>
otherwise using<br>
printf will lead to a bug each time the programmer forget<br>
the trailing<br>
\0.<br>
<br>
<br>
Due to slicing, it is already unsafe to pass a D string to C<br>
code. The main problem is array casting silently to pointers,<br>
making the error easy to do.<br>
<br>
<br>
How so? strings are immutable, and literals are *truly* immutable.<br>
<br>
<br>
Fixing the problem for literal isn't going to solve it at all.<br>
<br>
The real solution is toStringz<br>
<br>
<br>
toStringz can allocate a new block in order to ensure 0 gets added.<br>
This is ludicrous!<br>
<br>
You are trying to tell me that any time I want to call a C function<br>
with a string literal, I have to first heap-allocate it, even though<br>
I *know* it's safe.<br>
<br>
I don't see a "problem" anywhere. The current system is perfect for<br>
what it needs to do.<br>
<br>
-Steve<br>
<br>
<br></div></div><div class="im">
Aside from the string problem the very existence of this debate exposes<br>
a fundamental flaw in the entire software engineering industry: heavy<br>
usage of ancient crap.<br>
If some library is so damned hard to refresh, then something's terribly<br>
wrong with it. It's about damned time ancient libraries are thrown away.<br>
<br>
--<br>
Bye,<br>
Gor Gyolchanyan.<br>
</div></blockquote>
<br>
I... don't think that's a very pragmatic view.<br>
<br>
Yes, software sucks. Deal with it, etc.<div class="HOEnZb"><div class="h5"><br>
<br>
-- <br>
Alex Rønne Petersen<br>
<a href="mailto:alex@lycus.org" target="_blank">alex@lycus.org</a><br>
<a href="http://lycus.org" target="_blank">http://lycus.org</a><br>
</div></div></blockquote></div><br>Deal with it? That's the attitude that made it this way in the first place. If you like having software this way till the end of times - be my guest. I for one will not tolerate this unacceptably obsolete software. If you want it to stop being this bad - you're welcome to join me in the effort to put an end to this. It seems impossible only because nobody actually tried doing anything and all everybody does is complain about ancient stuff still requiring compatibility. With some effort that can be changed. Ancient libraries still require compatibility not because it's a rule, but because there are people who use them. They use them because there are no alternatives. If some people deliberately refuse to embrace the progress - it's their damned problem.<div>
<div><br></div>-- <br>Bye,<br>Gor Gyolchanyan.<br>
</div>