Re: Struct Constructors

2014-06-16 Thread Mark Blume via Digitalmars-d-learn
Adam, Dicebot, Thank you very much for the fast reply. I think this should be addressed at the documentation since it has ability to cause confusion for newbies like me.

Re: Working on a library: request for code review

2014-06-16 Thread Rene Zwanenburg via Digitalmars-d-learn
On Monday, 16 June 2014 at 19:42:14 UTC, Mike wrote: I have refactored the code as recommended. I have also modified the not-yet-reviewed writers part to take advantage of the same approach (preallocated static-sized buffer) rather than allocate slices in loops. Hoping to hear something

D1: UTF8 char[] casting to wchar[] array cast misalignment ERROR

2014-06-16 Thread jicman via Digitalmars-d-learn
Greetings! I have a bunch of files plain ASCII, UTF8 and UTF16 with and without BOM (Byte Order Mark). I had, I thought, a nice way of figuring out what type of encoding the file was (ASCII, UTF8 or UTF16) when the BOM was missing, by reading the content and applying the std.utf.validate

Trying to sort shared data with a predicate causes 'unable to format shared objects'

2014-06-16 Thread George Sapkin via Digitalmars-d-learn
I'm trying to sort shared data with a predicate. Buy that causes 'unable to format shared objects'. Here's an example reproducing the issue without any threading code: shared class SomeClass { immutable int value; this(const int value) { this.value = value; } } void main() {

Re: How to define and use a custom comparison function

2014-06-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Tuesday, 17 June 2014 at 04:32:20 UTC, Jakob Ovrum wrote: On Monday, 16 June 2014 at 20:49:29 UTC, monarch_dodra wrote: MyCompare cmp(SortOrder.ASC, 10); This syntax is not valid D. It should be: auto cmp = MyCompare(SortOrder,ASC, 10); Sorry, that first comma is a typo and should

Re: How to define and use a custom comparison function

2014-06-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Monday, 16 June 2014 at 20:49:29 UTC, monarch_dodra wrote: MyCompare cmp(SortOrder.ASC, 10); This syntax is not valid D. It should be: auto cmp = MyCompare(SortOrder,ASC, 10);

Re: Trying to sort shared data with a predicate causes 'unable to format shared objects'

2014-06-16 Thread Ali Çehreli via Digitalmars-d-learn
On 06/16/2014 07:45 PM, George Sapkin wrote: I'm trying to sort shared data with a predicate. Buy that causes 'unable to format shared objects'. Here's an example reproducing the issue without any threading code: shared class SomeClass { immutable int value; this(const int value) {

Re: Placement of shared does not allow to set a delegate

2014-06-16 Thread Ali Çehreli via Digitalmars-d-learn
On 06/16/2014 09:37 AM, Tolga Cakiroglu wrote: On Monday, 16 June 2014 at 15:25:51 UTC, Ali Çehreli wrote: Okay, now I continue with another thing. After defining the event attribute as follows public void delegate( shared(SocketListener) sender ) shared eventWhenStarted; --- I

[Help]How to handle exception from dirEntries?

2014-06-16 Thread Keqin via Digitalmars-d-learn
Hi everyone, I have write a short program to check file size recursively as bellow. If i run this exe on windows eg.: hello.exe --dir C:\ It will throw as: std.file.FileException@std\file.d(2519): C:\$Recycle.Bin\S-1-5-18: Access is den ied. I believe the exception comes from the

Re: [Help]How to handle exception from dirEntries?

2014-06-16 Thread Ali Çehreli via Digitalmars-d-learn
On 06/16/2014 09:44 PM, Keqin wrote: Hi everyone, std.file.FileException@std\file.d(2519): C:\$Recycle.Bin\S-1-5-18: Access is den ied. I believe the exception comes from the following line: auto entries = dirEntries(dirpath, SpanMode.depth); Known issue:

Re: [Help]How to handle exception from dirEntries?

2014-06-16 Thread Keqin via Digitalmars-d-learn
Thanks for your reply! On Tuesday, 17 June 2014 at 04:50:43 UTC, Ali Çehreli wrote: On 06/16/2014 09:44 PM, Keqin wrote: Hi everyone, std.file.FileException@std\file.d(2519): C:\$Recycle.Bin\S-1-5-18: Access is den ied. I believe the exception comes from the following line: auto entries

[Issue 12928] Range check dropped for array[length]

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12928 Lionello Lunesu lio+bugzi...@lunesu.com changed: What|Removed |Added Keywords||pull --- Comment

[Issue 12928] Range check dropped for array[length]

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12928 Lionello Lunesu lio+bugzi...@lunesu.com changed: What|Removed |Added Assignee|nob...@puremagic.com

[Issue 12928] Bounds check dropped for array[length]

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12928 Lionello Lunesu lio+bugzi...@lunesu.com changed: What|Removed |Added Summary|Range check dropped for |Bounds check

[Issue 6478] Implement conservative range-checking for array lengths

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6478 Lionello Lunesu lio+bugzi...@lunesu.com changed: What|Removed |Added CC|

[Issue 12929] New: Empty union followed by field causes ICE due to offset of 0.

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12929 Issue ID: 12929 Summary: Empty union followed by field causes ICE due to offset of 0. Product: D Version: D2 Hardware: x86_64 OS: All Status: NEW

[Issue 12930] New: static and the access modifiers aren't legal on the right-hand side of a function

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12930 Issue ID: 12930 Summary: static and the access modifiers aren't legal on the right-hand side of a function Product: D Version: unspecified Hardware: All OS: All

[Issue 12931] New: Make const, immutable, and inout illegal as funtion attributes on the left-hand side of a function

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12931 Issue ID: 12931 Summary: Make const, immutable, and inout illegal as funtion attributes on the left-hand side of a function Product: D Version: unspecified Hardware: All

[Issue 12930] static and the access modifiers aren't legal on the right-hand side of a function

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12930 --- Comment #1 from Jonathan M Davis jmdavisp...@gmx.com --- Related: https://issues.dlang.org/show_bug.cgi?id=12931 --

[Issue 12931] Make const, immutable, and inout illegal as funtion attributes on the left-hand side of a function

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12931 bearophile_h...@eml.cc changed: What|Removed |Added CC||bearophile_h...@eml.cc --- Comment

[Issue 12932] New: Support @nogc for immediately iterated array literal

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12932 Issue ID: 12932 Summary: Support @nogc for immediately iterated array literal Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement

[Issue 12933] New: [D1] ICE with default __FILE__ and __LINE__

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12933 Issue ID: 12933 Summary: [D1] ICE with default __FILE__ and __LINE__ Product: D Version: D1 Hardware: x86_64 OS: Linux Status: NEW Severity: normal

[Issue 12932] Support @nogc for immediately iterated array literal

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12932 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added Keywords||pull --- Comment #1 from

[Issue 12934] New: Strange newly implemented VRP behavior on foreach

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12934 Issue ID: 12934 Summary: Strange newly implemented VRP behavior on foreach Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: rejects-valid

[Issue 12934] Strange newly implemented VRP behavior on foreach

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12934 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added Keywords||pull --- Comment #1 from

[Issue 12932] Support @nogc for immediately iterated array literal

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12932 bearophile_h...@eml.cc changed: What|Removed |Added CC||bearophile_h...@eml.cc --- Comment

[Issue 12935] New: Cannot log in to code.lang.org with current accounts on Bugzilla or Wiki

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12935 Issue ID: 12935 Summary: Cannot log in to code.lang.org with current accounts on Bugzilla or Wiki Product: D Version: unspecified Hardware: x86_64 OS: Linux

[Issue 12927] Can't get at compile-time the immutable field of a struct instance in a TypeTuple

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12927 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 12927] Can't get at compile-time the immutable field of a struct instance in a TypeTuple

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12927 --- Comment #2 from bearophile_h...@eml.cc --- (In reply to Kenji Hara from comment #1) In 2.063 and earlier, the code had been incorrectly accepted. Bar.foos is an instance field, so cannot evaluate it without valid 'this' expression. I see.

[Issue 12932] Support @nogc for immediately iterated array literal

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12932 --- Comment #3 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/dfb44a6d1f851eb9048ef459bf075f953a290fbf fix Issue 12932 - Support

[Issue 12933] [D1] ICE with default __FILE__ and __LINE__

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12933 Leandro Lucarella leandro.lucare...@sociomantic.com changed: What|Removed |Added Keywords|

[Issue 12932] Support @nogc for immediately iterated array literal

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12932 --- Comment #4 from bearophile_h...@eml.cc --- Currently this gets rejected, is this right? void main() @nogc { foreach ( a; [[1]]) {} foreach (int[1] a; [[1]]) {} } test.d(2): Error: array literal in @nogc function main may cause GC

[Issue 12932] Support @nogc for immediately iterated array literal

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12932 --- Comment #5 from bearophile_h...@eml.cc --- A better example: struct F { int x; } void main() @nogc { foreach ( a; [[1]]) {} // Error foreach (int[1] a; [[1]]) {} // Error foreach ( a; [F(1)]) {} // OK } --

[Issue 12932] Support @nogc for immediately iterated array literal

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12932 --- Comment #6 from Kenji Hara k.hara...@gmail.com --- (In reply to bearophile_hugs from comment #4) Currently this gets rejected, is this right? void main() @nogc { foreach ( a; [[1]]) {} foreach (int[1] a; [[1]]) {} }

[Issue 12932] Support @nogc for immediately iterated array literal

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12932 --- Comment #8 from Kenji Hara k.hara...@gmail.com --- (In reply to bearophile_hugs from comment #7) OK. Do you want me to open another enhancement request, or do you want me to reopen this one, or do you think this improved feature is not worth

[Issue 12932] Support @nogc for immediately iterated array literal

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12932 --- Comment #7 from bearophile_h...@eml.cc --- (In reply to Kenji Hara from comment #6) My PR does not support complex case. It would need more thought to improve the feature. OK. Do you want me to open another enhancement request, or do you want

[Issue 12932] Support @nogc for immediately iterated array literal

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12932 --- Comment #9 from bearophile_h...@eml.cc --- (In reply to Kenji Hara from comment #8) (In reply to bearophile_hugs from comment #7) OK. Do you want me to open another enhancement request, or do you want me to reopen this one, or do you think

[Issue 12936] New: Some more @nogc cases for immediately iterated array literal

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12936 Issue ID: 12936 Summary: Some more @nogc cases for immediately iterated array literal Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW

[Issue 12934] Strange newly implemented VRP behavior on foreach

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12934 --- Comment #2 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/bfc07fc275c25520e26821f542b0260e530df30e fix Issue 12934 - Strange

[Issue 12934] Strange newly implemented VRP behavior on foreach

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12934 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 12933] [D1] ICE with default __FILE__ and __LINE__

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12933 --- Comment #1 from github-bugzi...@puremagic.com --- Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/1bbc21edbe15f93a0a80bf2b2ffca5b923c0a3a4 fix Issue 12933 - [D1] ICE

[Issue 12933] [D1] ICE with default __FILE__ and __LINE__

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12933 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 12862] [ICE] backend assertion (Internal error: backend/cg87.c 331) with inline, optimizing and floats

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12862 --- Comment #2 from Martin Nowak c...@dawg.eu --- Mmh, the codegen assertion vanished with this commit (https://github.com/D-Programming-Language/dmd/commit/9efe7f74c2462e8743f5a479cd04f9be733be4b0). I reproduced another test case for the issue. cat

[Issue 12933] [D1] ICE with default __FILE__ and __LINE__

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12933 --- Comment #2 from Dicebot pub...@dicebot.lv --- Thanks, that was really quick! --

[Issue 12889] std.array replaceInPlace overlapping array copy error

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12889 safety0ff.bugz safety0ff.b...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 12212] Static array assignment makes slice implicitly

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12212 safety0ff.bugz safety0ff.b...@gmail.com changed: What|Removed |Added CC|

[Issue 12937] New: ICE with void static array initializing

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12937 Issue ID: 12937 Summary: ICE with void static array initializing Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: ice Severity:

[Issue 12928] Bounds check dropped for array[length]

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12928 --- Comment #6 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/fc5fc7de8df08792ce9dbb60d4c265d49b445fa6 Issue 12928 - Range check

[Issue 12937] ICE with void static array initializing

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12937 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added Keywords||pull --- Comment #1 from

[Issue 5710] cannot use delegates as parameters to non-global template

2014-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=5710 --- Comment #40 from Sobirari Muhomori dfj1es...@sneakemail.com --- This is exactly my point: don't make it a different thing. The function needs two contexts, they can be nested, backend and frontend can construct and access such nested contexts, no

<    1   2   3