| Thread overview | ||||||||
|---|---|---|---|---|---|---|---|---|
|
November 27, 2013 [Issue 7175] Zero-length static array .ptr is always null | ||||
|---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=7175 yebblies <yebblies@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull CC| |yebblies@gmail.com --- Comment #1 from yebblies <yebblies@gmail.com> 2013-11-27 19:27:34 EST --- https://github.com/D-Programming-Language/dmd/pull/2888 -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- | ||||
November 27, 2013 [Issue 7175] Zero-length static array .ptr is always null | ||||
|---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=7175 bearophile_hugs@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs@eml.cc --- Comment #2 from bearophile_hugs@eml.cc 2013-11-27 00:46:46 PST --- Do you mean in this code: import core.stdc.stdlib, std.stdio; struct VariableLength(T) { size_t len; T[0] items; @property T[] data() inout pure nothrow { return (cast(T*)&items)[0 .. len]; } static typeof(this)* New(in size_t len) nothrow { auto vptr = cast(typeof(this)*)calloc(1, typeof(this).sizeof + T.sizeof * len); vptr.len = len; return vptr; } alias data this; } void main() { enum n = 0100; auto v = VariableLength!int.New(n); foreach (immutable i; 0 .. n) (*v)[i] = i * 10; foreach (immutable i; 0 .. n) writeln((*v)[i]); } The data() function will be written just like this? @property T[] data() inout pure nothrow { return items.ptr[0 .. len]; } -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- | ||||
November 27, 2013 [Issue 7175] Zero-length static array .ptr is always null | ||||
|---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=7175 --- Comment #3 from yebblies <yebblies@gmail.com> 2013-11-27 20:37:22 EST --- (In reply to comment #2) > Do you mean in this code: > > [snip] > > > The data() function will be written just like this? > > @property T[] data() inout pure nothrow { > return items.ptr[0 .. len]; > } Looks like you'll still need to cast away inout in that example, but yeah. Where a is a zero-length static array a.ptr -> &a -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- | ||||
December 02, 2013 [Issue 7175] Zero-length static array .ptr is always null | ||||
|---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=7175 --- Comment #4 from github-bugzilla@puremagic.com 2013-12-01 17:57:27 PST --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/36c9b648a5701c4a9a73f3b1abf33e9a18e54839 Fix Issue 7175 - Zero-length static array .ptr is always null https://github.com/D-Programming-Language/dmd/commit/7652cfc7e279a2c23e4921bf52d46a6d663af253 Merge pull request #2888 from yebblies/issue7175 Issue 7175 - Zero-length static array .ptr is always null -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- | ||||
December 02, 2013 [Issue 7175] Zero-length static array .ptr is always null | ||||
|---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=7175 yebblies <yebblies@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- | ||||
December 10, 2013 [Issue 7175] Zero-length static array .ptr is always null | ||||
|---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=7175 --- Comment #5 from github-bugzilla@puremagic.com 2013-12-10 15:34:19 PST --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/3bf7718d82848f21b9e5562c96f3c7e8702c7ea7 Update message changed by fixing issue 7175 -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply