Hi all,
inside http://dlang.org/dmd-windows.html#environment down in the section
titled Differences between Windows and Linux versions, the statement is:
"String literals are read-only under Linux. Attempting to write to them
will cause a segment violation."
This looks like an old and obsol
It's out of date.
Or is this statement there to want you not take the address of
a string literal and attempt to write it via a pointer?
Even then you have to actively try and break the type system
auto p = cast(char*) "foo".ptr;
And if you remove the brakes from your car, you shouldn't
That being said, it does no harm (i.e. it isn't _wrong_).
On 12-06-25 9:06 PM, Bernard Helyer wrote:
That being said, it does no harm (i.e. it isn't _wrong_).
Understood, but it might be a good thing to qualify it. I am looking at
D again (D2.0) and would like to start pushing it for my group at work.
Unqualified statements like this might scare a
On Tuesday, 26 June 2012 at 00:56:48 UTC, Pierre Rouleau wrote:
"String literals are read-only under Linux. Attempting to write
to them will cause a segment violation."
You have read this completely wrong.
It is still true today.
Linux places string literals in Read-Only Memory, Windows does
On Tuesday, 26 June 2012 at 03:02:45 UTC, Jesse Phillips wrote:
Linux places string literals in Read-Only Memory, Windows does
not. This is OS specific behavior and does not relate to the
language in the least.
Isn't it compiler-specific behavior?
Visual C++ does this on Windows.
After all, it
On Tuesday, 26 June 2012 at 03:44:17 UTC, Mehrdad wrote:
On Tuesday, 26 June 2012 at 03:02:45 UTC, Jesse Phillips wrote:
Linux places string literals in Read-Only Memory, Windows does
not. This is OS specific behavior and does not relate to the
language in the least.
Isn't it compiler-specifi
On 2012-06-26 02:56, Pierre Rouleau wrote:
Hi all,
inside http://dlang.org/dmd-windows.html#environment down in the section
titled Differences between Windows and Linux versions, the statement is:
"String literals are read-only under Linux. Attempting to write to them
will cause a segment viola
On 12-06-25 11:02 PM, Jesse Phillips wrote:
On Tuesday, 26 June 2012 at 00:56:48 UTC, Pierre Rouleau wrote:
"String literals are read-only under Linux. Attempting to write to
them will cause a segment violation."
You have read this completely wrong.
OK, understood. The last two sentences of
On 12-06-26 6:34 AM, Jacob Carlborg wrote:
On 2012-06-26 02:56, Pierre Rouleau wrote:
This is still true for D1 which doesn't have immutable or const. Where
this is legal:
char[] str = "asd";
str[0] = 'b'; // ok on windows, segfault on posix
Thanks for clarifying this Jacob,
--
Pierre R
On 07/01/2012 06:42 PM, Pierre Rouleau wrote:
> Would the following rewrite of the above statement maintain the original
> intent while conveying a little bit more information?
>
> "It is never a good idea to write into a string literal.
"never a good idea" would be too permissive and welcoming.
On 12-07-02 4:58 AM, Ali Çehreli wrote:
On 07/01/2012 06:42 PM, Pierre Rouleau wrote:
> Would the following rewrite of the above statement maintain the original
> intent while conveying a little bit more information?
>
> "It is never a good idea to write into a string literal.
"never a good
12 matches
Mail list logo