Re: dmd: if still there

2014-09-21 Thread Rainer Schuetze via Digitalmars-d
On 19.09.2014 17:30, Daniel Murphy wrote: Chris wrote in message news:kcsnboocxeykhknjl...@forum.dlang.org... Out of curiosity. dmd still produces the if statement, although it ain't gonna happen. Same is true of DoIt.yes. I know, it's an unlikely and marginal example. No it doesn't

Re: dmd: if still there

2014-09-21 Thread Vladimir Panteleev via Digitalmars-d
On Sunday, 21 September 2014 at 13:28:59 UTC, Rainer Schuetze wrote: dmd didn't do any inlining at all. It is very restrained with inlining, you'll get much better results with GDC or LDC. I believe the function *was* inlined, however the function was still compiled separately and included in

dmd: if still there

2014-09-19 Thread Chris via Digitalmars-d
Out of curiosity. dmd still produces the if statement, although it ain't gonna happen. Same is true of DoIt.yes. I know, it's an unlikely and marginal example. [code] import std.stdio; enum DoIt { yes, no } void main() { doit(DoIt.no); } void doit(DoIt flag) { if (flag == DoIt.yes

Re: dmd: if still there

2014-09-19 Thread Daniel Murphy via Digitalmars-d
Chris wrote in message news:kcsnboocxeykhknjl...@forum.dlang.org... Out of curiosity. dmd still produces the if statement, although it ain't gonna happen. Same is true of DoIt.yes. I know, it's an unlikely and marginal example. No it doesn't, here's main: _Dmain: push RBP mov RBP,RSP mov

Re: dmd: if still there

2014-09-19 Thread Chris via Digitalmars-d
On Friday, 19 September 2014 at 15:30:25 UTC, Daniel Murphy wrote: Chris wrote in message news:kcsnboocxeykhknjl...@forum.dlang.org... Out of curiosity. dmd still produces the if statement, although it ain't gonna happen. Same is true of DoIt.yes. I know, it's an unlikely and marginal

Re: Is this statement in http://dlang.org/dmd-windows.html still true?

2012-07-02 Thread Ali Çehreli
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. The

Re: Is this statement in http://dlang.org/dmd-windows.html still true?

2012-07-02 Thread Pierre Rouleau
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 idea

Re: Is this statement in http://dlang.org/dmd-windows.html still true?

2012-07-01 Thread Pierre Rouleau
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

Re: Is this statement in http://dlang.org/dmd-windows.html still true?

2012-07-01 Thread Pierre Rouleau
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

Re: Is this statement in http://dlang.org/dmd-windows.html still true?

2012-06-26 Thread Jacob Carlborg
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

Is this statement in http://dlang.org/dmd-windows.html still true?

2012-06-25 Thread Pierre Rouleau
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

Re: Is this statement in http://dlang.org/dmd-windows.html still true?

2012-06-25 Thread Bernard Helyer
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

Re: Is this statement in http://dlang.org/dmd-windows.html still true?

2012-06-25 Thread Bernard Helyer
That being said, it does no harm (i.e. it isn't _wrong_).

Re: Is this statement in http://dlang.org/dmd-windows.html still true?

2012-06-25 Thread Pierre Rouleau
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

Re: Is this statement in http://dlang.org/dmd-windows.html still true?

2012-06-25 Thread Jesse Phillips
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

Re: Is this statement in http://dlang.org/dmd-windows.html still true?

2012-06-25 Thread Mehrdad
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,

Re: Is this statement in http://dlang.org/dmd-windows.html still true?

2012-06-25 Thread Jesse Phillips
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