On Monday, 19 November 2018 at 06:46:55 UTC, dangbinghoo wrote:
So, can you experts give a more comprehensive compare with
perl6 and D?
Sure!
1). You can actually read and understand D code.
On Friday, 9 November 2018 at 00:18:28 UTC, H. S. Teoh wrote:
It's not true that you're stuck with dub. And I'm not among
the people who think dub is the way to go (though it's true
that that's a minority opinion around here). Where I have a
choice, my own D projects do not use dub.
Me
On Wednesday, 17 October 2018 at 03:37:21 UTC, Ky-Anh Huynh wrote:
Hi,
I need to build some static binaries with LDC. I also need to
execute builds on both platform 32-bit and 64-bit.
From Docker Hub there are two image groups:
* language/ldc (last update 5 months ago)
* dlang2/ldc-ubuntu
On Tuesday, 2 October 2018 at 07:32:58 UTC, Joakim wrote:
Thank you for making clear that the real reason you and some
others like the current format is because you want to have a
fun "vacation"- as I pointed out in that earlier thread- rather
than anything to do with D or advancing the
On Tuesday, 25 September 2018 at 13:03:30 UTC, FeepingCreature
wrote:
I'm playing with a branch of DMD that would warn on unused
imports:
Honestly, I hate these types of warnings/errors. It makes playing
with and designing code such a chore. I hope this is opt-in.
On Sunday, 23 September 2018 at 02:40:15 UTC, Nicholas Wilson
wrote:
It appears that @implicit has been removed from the
implementation [1], but not yet from the DIP.
https://github.com/dlang/dmd/commit/cdd8100
Good, It's not needed.
On Friday, 21 September 2018 at 12:15:52 UTC, NX wrote:
How can I properly convert a character, say, first one to upper
case in a unicode correct manner?
In which code level I should be working on? Grapheme? Or maybe
code point is sufficient?
There are few phobos functions like
Why do some attributes have an @ symbol and others don't?
I thought it might be because some are used as keywords for other
things but then 'pure' doesn't follow that rule. Any ideas? Is it
just a legacy thing?
On Wednesday, 12 September 2018 at 16:40:45 UTC, Jonathan M Davis
wrote:
Ultimately, I expect that if we add any attribute for this,
people coming to D are going to think that it's downright
weird, but if we're going to have one, if we go with @implicit,
we're future-proofing things a bit, and
On Tuesday, 11 September 2018 at 15:08:33 UTC, RazvanN wrote:
Hello everyone,
I have finished writing the last details of the copy
constructor DIP[1] and also I have published the first
implementation [2]. As I wrongfully made a PR for the DIP queue
in the early stages of the development of
On Thursday, 9 August 2018 at 13:42:57 UTC, bachmeier wrote:
On Thursday, 9 August 2018 at 03:02:55 UTC, Mike Parker wrote:
This is the feedback thread for the first round of Community
Review for DIP 1017, "Add Bottom Type":
I hope there is a better name than Tbottom. A name like that is
not
On Wednesday, 1 August 2018 at 14:58:56 UTC, Ky-Anh Huynh wrote:
This works well with user interaction. However I don't really
like the idea of using temporary files. Is there any better way?
Maybe take a look at:
https://dlang.org/library/std/process/pipe_shell.html
I just saw this on hacker news:
We present Ryū, a new routine to convert binary floating point
numbers to their decimal representations using only fixed-size
integer operations, and prove its correctness. Ryū is simpler
and approximately three times faster than the previously
fastest
On Friday, 13 July 2018 at 18:37:35 UTC, vino.B wrote:
Hi All,
How do i check whether a range is empty. eg.
(!PFResutl.toRange).empty. I tired the below, but it is no
printing Empty if the range is empty it just prints blank line.
if (!(!PFResutl.toRange).empty) { writeln("Empty"); }
On Tuesday, 10 July 2018 at 20:33:46 UTC, Seb wrote:
But they easily can be:
https://github.com/dlang/dlang.org/pull/2415
Thanks.
Looking at the page on -betterC it says that struct destructors
are not available.
See point 11:
https://dlang.org/spec/betterc.html#consequences
This doesn't seem to be true as I'm using them with no problem.
On Monday, 18 June 2018 at 06:37:41 UTC, Mr.Bingo wrote:
These go in the module you want allow access to the outside
world just as if they were in the same module!
See the package attribute:
https://dlang.org/spec/attribute.html#visibility_attributes
On Thursday, 21 December 2017 at 13:59:28 UTC, Jack Stouffer
wrote:
A couple of months ago, Andrei noted that a donor asked for a
precise decimal type for D specifically:
https://forum.dlang.org/post/osnema$d5s$1...@digitalmars.com. I've
also heard this asked for many times, so I decided to
On Wednesday, 7 March 2018 at 17:11:55 UTC, H. S. Teoh wrote:
Kill autodecoding, I say. Kill it with fire!!
T
Please!!!
On Friday, 2 March 2018 at 08:44:53 UTC, Gary Willoughby wrote:
It would be interesting to test whether those methods handle
these scenarios.
Yeah, it doesn't work.
https://dpaste.dzfl.pl/55116efd0c9c
On Thursday, 1 March 2018 at 12:20:08 UTC, Steven Schveighoffer
wrote:
On 3/1/18 7:05 AM, Gary Willoughby wrote:
On Thursday, 1 March 2018 at 10:10:27 UTC, John Burton wrote:
My question is how do I tell if a pointer is "garbage
collected" or not?
You could try `GC.addrOf()` or `GC.query()`
On Thursday, 1 March 2018 at 10:10:27 UTC, John Burton wrote:
My question is how do I tell if a pointer is "garbage
collected" or not?
You could try `GC.addrOf()` or `GC.query()` in core.memory.
On Wednesday, 6 December 2017 at 16:47:17 UTC, A Guy With a
Question wrote:
abstract class Test(T)
{
private:
T thing;
public:
this(T theThing)
{
thing = theThing;
thisdoesnotexist(); // expect compiler error right here
}
}
...but this compiles just fine.
On Friday, 10 November 2017 at 16:09:48 UTC, Stefan Koch wrote:
please don't answer messages which are possibly spam.
Try this by not answering to this thread.
Ok! +1 ;)
On Sunday, 25 June 2017 at 23:21:25 UTC, aberba wrote:
Can you share feature(s) in D people are not talking about
which you've found very useful?
Some of the best features are in the standard library. I've
written about them here:
On Tuesday, 24 October 2017 at 13:20:10 UTC, Andrei Alexandrescu
wrote:
A person who donated to the Foundation made a small wish list
known. Allow me to relay it:
* RSA Digital Signature Validation in Phobos
* std.decimal in Phobos
* better dll support for Windows.
Andrei
std.decimal has
On Tuesday, 24 October 2017 at 17:30:27 UTC, Andrey wrote:
Hello, why there are no named arguments for functions like, for
example, in kotlin i.e.:
int sum(in int a, in int b) {
return a + b;
}
sum(a = 1, b = 2);
This has been discussed to death:
On Saturday, 21 October 2017 at 08:14:01 UTC, vondes wrote:
How we can use it in https://mobile-phone-tracker.org mobile
recorder on Android?
That doesn't look like a very ethical program.
On Wednesday, 27 September 2017 at 14:23:01 UTC, Ky-Anh Huynh
wrote:
Can you please explain and give any link where I can learn more
about these things?
Thanks a lot.
http://nomad.so/2013/07/templates-in-d-explained/
On Wednesday, 13 September 2017 at 17:55:43 UTC, Steven
Schveighoffer wrote:
Note BTW, the C headers are included in the distribution, and
those are NOT boost licensed. I'm not a lawyer, so I have no
idea the compatibility implications between the two.
Thanks for the heads up, they've now
I've just installed the latest dmd version (on ubuntu 64bit) and
I get this:
$ dmd --version
DMD64 D Compiler v2.076.0-dirty
Copyright (c) 1999-2017 by Digital Mars written by Walter Bright
What does 'dirty' mean?
Hi,
A few years ago I forked the Deimos X11 bindings[1] repo to add
dub support. Since then my repo[2] has received bug fixes and as
such it's being used in many projects. (Also, in the following
years dub support was added to the Deimos repo too.) I had a
question from a developer as to the
On Thursday, 24 August 2017 at 11:07:16 UTC, Suliman wrote:
All modern languages like Dart and C# have string
interpolation. Sharp example:
Console.WriteLine($"Hello {args[0]}!");
Who can summary is there any objective reasons why it's not
realized in D?
Maybe you ought to read this entire
On Tuesday, 15 August 2017 at 03:37:39 UTC, rikki cattermole
wrote:
On 15/08/2017 2:59 AM, Johnson wrote:
Not only that, but it requires adding more files to the
command line.
I currently have 3 import files to separate the gtk from gdk
that and the only reason they exist is to combine them
On Tuesday, 15 August 2017 at 03:53:44 UTC, Michael V. Franklin
wrote:
An implementation of binary assignment operators for @property
functions has been submitted to the DMD pull request queue at
https://github.com/dlang/dmd/pull/7079. It addresses the
following issues:
Issue 8006 -
On Wednesday, 19 July 2017 at 07:22:48 UTC, John Burton wrote:
In C++ I could use static or an anonymous namespace for
implementation functions, but there doesn't seem to be anything
similar in D.
Is there any way to achieve what I want in D (Private
implementation functions)
Try the package
On Tuesday, 27 June 2017 at 14:32:28 UTC, Vladimir Panteleev
wrote:
- Yes, not everyone likes colors. You can turn all colors off
with a command-line switch.
- Yes, everyone agrees that having all colors be configurable
would be good. We still need defaults that are going to look OK
on most
I think it's important to understand, D is *not* Java.
D Language accepted for inclusion in GCC:
https://gcc.gnu.org/ml/gcc/2017-06/msg00111.html
Well done Iain Buclaw!
Reddit thread:
https://www.reddit.com/r/programming/comments/6im1yo/david_edelsohn_d_language_accepted_for_inclusion/
Inside D's GC blog article currently No.3 on hacker news
Here's the article, visit hacker news to read the comments.
http://olshansky.me/gc/runtime/dlang/2017/06/14/inside-d-gc.html
On Tuesday, 13 June 2017 at 11:36:45 UTC, Steven Schveighoffer
wrote:
Nope, const works just fine. A clue is in your return type --
it's not inout!
This should work:
public Rational opBinary(string op)(Rational rhs) const
If Rational had any indirections, then inout would be required,
and
On Monday, 12 June 2017 at 20:10:17 UTC, H. S. Teoh wrote:
Therefore, nowadays I always recommend writing parenthesis with
type modifiers, so that the intent it unambiguous, i.e., always
write `inout(Rational)` rather than `inout Rational`, unless
you intend for `inout` to apply to the
On Monday, 12 June 2017 at 19:36:52 UTC, H. S. Teoh wrote:
On Mon, Jun 12, 2017 at 07:38:44PM +, Gary Willoughby via
Digitalmars-d-learn wrote:
In the following code is there any way to make the `opBinary`
method generic to be able to accept immutable as well as a
standard type? The code
I don't know how H. S. Teoh managed to answer 'before' I posted
but thanks guys! :)
In the following code is there any way to make the `opBinary`
method generic to be able to accept immutable as well as a
standard type? The code currently passes the unit test but I
wonder if I could get rid of the duplication to overload the
operator? I'm failing badly.
import std.stdio;
On Friday, 26 May 2017 at 09:59:26 UTC, zakk wrote:
1) Why is D making using of the binary ! operator, which as far
as I understand introduces a template?
The exclamation mark here is not a binary operator, it's used in
D templates to define where compile-time parameters are.
2) Why is a
On Saturday, 20 May 2017 at 12:25:39 UTC, Stanislav Blinov wrote:
Oof. Dangerous stuff.
:)
Thanks for the heads up but I think I'm covering all cases in my
main code.
On Saturday, 20 May 2017 at 11:15:57 UTC, Moritz Maxeiner wrote:
Because `element = tmp` destroys `element`, which you allocated
filled with zeroes.
The destructor will run for each `element`.
Right, I get it because the destructors running on the struct
that is being replaced. Doh!
In the following code, the `_foo` pointer (of the Foo struct) is
null in the first call to the destructor. Why is this? I think
it's got something to do with the foreach loop but I'm not sure.
Any ideas?
import std.stdio;
import core.stdc.stdlib : malloc, calloc, free;
struct Foo
{
On Thursday, 18 May 2017 at 21:09:06 UTC, Igor wrote:
On Thursday, 18 May 2017 at 20:20:47 UTC, Gary Willoughby wrote:
This might be a really silly question but:
I've allocated some memory like this (Foo is a struct):
this._data = cast(Foo*) calloc(n, Foo.sizeof);
How can I then later
This might be a really silly question but:
I've allocated some memory like this (Foo is a struct):
this._data = cast(Foo*) calloc(n, Foo.sizeof);
How can I then later check that there is a valid Foo at
`this._data` or `this._data + n`?
On Friday, 21 April 2017 at 12:32:01 UTC, Nick Sabalausky
(Abscissa) wrote:
"Completely unnecessary" features like that are exactly what
make D worthwhile in the first place. Otherwise may as well
stick to C++ or Java.
Multiple ways of doing the same thing are not valuable or
progressive.
On Thursday, 20 April 2017 at 18:28:30 UTC, Atila Neves wrote:
I don't understand how
writeln($"{a} times 3 is {a * 3}");
is even marginally better than
writeln(a, " times 3 is ", a * 3); // look ma, works right now!
It's not even fewer characters.
Atila
This!
This is bloat that doesn't
On Wednesday, 5 April 2017 at 21:58:16 UTC, Inquie wrote:
What I am looking for is something like StringBuilder in C#.
std.array.appender
On Wednesday, 29 March 2017 at 19:19:48 UTC, Enigma wrote:
I have a memory buffer allocated using different methods. It is
simply a pointer and a size.
I would like to be able to manage this buffer by treating it as
a memory pool or heap. I think I can use allocators to do this
but not sure
On Sunday, 26 March 2017 at 23:25:49 UTC, XavierAP wrote:
I've looked into Phobos to emulate it when defining my own
trait template, and when I see this:
module std.range.primitives;
// ...
template isInputRange(R)
{
enum bool isInputRange = is(typeof(
(inout int = 0)
{
R r
On Monday, 30 January 2017 at 02:56:27 UTC, Nick Sabalausky wrote:
I've been working on a big refresh of mysql-native's API, to
take care of various issues that have appeared with it. It
involves some major breaking changes (although I've tried to
keep old interfaces around for the moment, but
On Tuesday, 20 December 2016 at 23:08:28 UTC, Andrei Alexandrescu
wrote:
Hello, a few engineers at Red Hat are taking a look at using
the D language on the desktop and have reached out to us. They
have created a list of issues. We are on the top-level ones,
and of course would appreciate any
On Tuesday, 13 December 2016 at 22:40:47 UTC, 01010100b wrote:
On the wiki there is an argument given for why not to allow "@"
on function attributes which are keywords, however it seems to
include a reasoning error.
Related DIP: https://wiki.dlang.org/DIP64
On Wednesday, 7 December 2016 at 16:35:52 UTC, Alex wrote:
mixin template S(T...)
{
void run()
{
foreach(s; T)
{
static assert(__traits(hasMember, s, "run"));
}
}
}
How to formulate the check inside the foreach as a template
constraint with
On Wednesday, 30 November 2016 at 22:49:12 UTC, Martin Nowak
wrote:
Glad to announce D 2.072.1.
http://dlang.org/download.html
This point release fixes a few issues over 2.072.0, see the
changelog for more details.
http://dlang.org/changelog/2.072.1.html
-Martin
The download page doesn't
What is the simplest way of doing @nogc string concatenation?
On Tuesday, 1 November 2016 at 14:06:08 UTC, Steven Schveighoffer
wrote:
On 10/31/16 3:08 PM, Gary Willoughby wrote:
Can someone please explain why the following assertion fails?
import std.stdio;
import std.conv;
void main(string[] args)
{
auto x = 1;
assert(hashOf(x.to!(string)) ==
On Monday, 31 October 2016 at 22:10:30 UTC, Ali Çehreli wrote:
On 10/31/2016 12:08 PM, Gary Willoughby wrote:
Can someone please explain why the following assertion fails?
import std.stdio;
import std.conv;
void main(string[] args)
{
auto x = 1;
assert(hashOf(x.to!(string)) ==
On Monday, 31 October 2016 at 19:24:13 UTC, Ali Çehreli wrote:
On 10/31/2016 12:08 PM, Gary Willoughby wrote:
[...]
Because it considers the .ptr property of arrays as well:
https://github.com/dlang/druntime/blob/master/src/core/internal/hash.d#L61
[...]
Ah right.
Is there an
On Monday, 31 October 2016 at 19:08:50 UTC, Gary Willoughby wrote:
Can someone please explain why the following assertion fails?
import std.stdio;
import std.conv;
void main(string[] args)
{
auto x = 1;
assert(hashOf(x.to!(string)) == hashOf(x.to!(string)));
}
Thanks.
DMD64
Can someone please explain why the following assertion fails?
import std.stdio;
import std.conv;
void main(string[] args)
{
auto x = 1;
assert(hashOf(x.to!(string)) == hashOf(x.to!(string)));
}
Thanks.
This was posted on twitter a while ago:
Comparing compilation time of random code in C++, D, Go, Pascal
and Rust
http://imgur.com/a/jQUav
D was doing well but in the larger examples the D compiler
crashed: "Error: more than 32767 symbols in object file".
On Tuesday, 20 September 2016 at 13:23:35 UTC, Jacob Carlborg
wrote:
On 2016-09-19 23:09, Gary Willoughby wrote:
$ rdmd --build-only --force -betterC -de -O -inline -release
-w test.d
$ nm test
Indeed. I just noticed now that there's a difference between
2.070.0 and 2.071.0. I get 4
On Monday, 20 June 2016 at 06:35:32 UTC, Jacob Carlborg wrote:
On 2016-06-19 21:53, Gary Willoughby wrote:
When compiling, what exactly does the -betterC flag do? The
command help
says "omit generating some runtime information and helper
functions" but
what does this really mean? Is there any
On Wednesday, 14 September 2016 at 11:54:56 UTC, Suliman wrote:
Sönke Ludwig, really sorry. It's look my big mistake. I looked
at SDL more detail, and this format is much better than JSON.
I hope a lot of people is changed their position too.
There is a superset of Json that could of been
On Wednesday, 25 November 2015 at 10:17:02 UTC, Suliman wrote:
I think that using SDL format was big mistake. Not only I do
not want to spend time in learning yet another dead config
format that now use only one project -- DUB. In time when DUB
used json it was not perfect, but at last it was
On Thursday, 15 September 2016 at 22:05:55 UTC, Ram_B wrote:
test.d(33): Error: variable f cannot be read at compile time
test.d(33): Error: string expected as second argument of
__traits hasMember instead of __error
test.d(46): Error: template instance test.A.t!(B) error
instantiating
Maybe
On Thursday, 15 September 2016 at 15:07:09 UTC, Ram_B wrote:
How i can get fields of derived classes in runtime? This not
works
What about something like this:
import std.traits;
import std.stdio;
class A {
int a,b;
this(){}
void fields(this T)(){
On Sunday, 11 September 2016 at 07:46:09 UTC, Manu wrote:
I'm having a lot of trouble debugging @nogc functions. I have a
number of debug functions that use GC, but I can't call them
from @nogc code... should debug{} allow @nogc calls, the same
as impure calls?
We could with something like
On Tuesday, 6 September 2016 at 19:18:11 UTC, John wrote:
This is all you need to know:
https://wiki.dlang.org/Property_Discussion_Wrap-up
Maybe related: https://issues.dlang.org/show_bug.cgi?id=16204
On Thursday, 11 August 2016 at 05:12:39 UTC, ag0aep6g wrote:
On 08/11/2016 06:15 AM, Engine Machine wrote:
void foo(@nogc void delegate())
doesn't work.
Put it after the parameter list, like so:
void foo(void delegate() @nogc)
You may also need to add the scope keyword too.
Reference:
On Tuesday, 9 August 2016 at 10:48:50 UTC, Zane wrote:
There has been a question or two about this before, but I
really don't feel there has been a reasonable answer (or I have
missed it).
[...]
There is one in the review queue since forever.
https://wiki.dlang.org/Review_Queue
Maybe take
On Sunday, 7 August 2016 at 18:37:19 UTC, ag0aep6g wrote:
On 08/07/2016 07:10 PM, ag0aep6g wrote:
https://github.com/dlang/druntime/pull/1624
Has been merged. Is going to be part of 2.072.
Very cool!
MurmurHash3 is a great addition too. Thanks guys.
I need a @nogc version of hashOf(). Here's one i'm currently
using but it's not marked as @nogc.
https://github.com/dlang/druntime/blob/master/src/object.d#L3170
What are the options now?
Is there anything D offers that I could use? I need a function
that takes a variable of any type and
On Thursday, 7 July 2016 at 10:48:56 UTC, Lodovico Giaretta wrote:
On Thursday, 7 July 2016 at 10:45:12 UTC, Gary Willoughby wrote:
On Thursday, 7 July 2016 at 08:21:53 UTC, Lodovico Giaretta
wrote:
Are you sure that this works in both big-endian and
little-endian systems?
It shouldn't
On Thursday, 7 July 2016 at 08:21:53 UTC, Lodovico Giaretta wrote:
Are you sure that this works in both big-endian and
little-endian systems?
It shouldn't matter. You're just interested in the high and low 4
byte chunks (which are to be interpreted as an int) which will
return in the
On Wednesday, 6 July 2016 at 21:44:37 UTC, BitGuy wrote:
I'm trying to implement a feistel cipher that'll give the same
results regardless of the endianness of the machine it runs on.
To make the cipher I need to split a 64bit value into two 32bit
values, mess with them, and then put them back
On Tuesday, 28 June 2016 at 06:13:44 UTC, Superstar64 wrote:
---
auto func(MyObj obj) with(obj)
{
//...
}
auto func(int arg) return arg;
auto func() try
{
//...
}
finally
{
return //...
}
---
Please no! All of these are awful.
On Friday, 24 June 2016 at 22:24:09 UTC, Walter Bright wrote:
Please post bug reports to bugzilla. They'll get lost in the
n.g.
Done. https://issues.dlang.org/show_bug.cgi?id=16204
On Friday, 24 June 2016 at 17:36:49 UTC, Gary Willoughby wrote:
When using the -profile flag is it known behaviour that phobos
unit tests fail?
(Ubuntu 16.04 - DMD64 D Compiler v2.071.0)
For example, when following these steps I get a failed unit
test:
$ cd /usr/include/dmd/phobos/std/
$
When using the -profile flag is it known behaviour that phobos
unit tests fail?
(Ubuntu 16.04 - DMD64 D Compiler v2.071.0)
For example, when following these steps I get a failed unit test:
$ cd /usr/include/dmd/phobos/std/
$ rdmd -I/usr/include/dmd/phobos/std
-I/usr/include/dmd/phobos/core
On Wednesday, 22 June 2016 at 13:36:54 UTC, Marc Schütz wrote:
On Tuesday, 21 June 2016 at 19:21:01 UTC, Gary Willoughby wrote:
Right ok, thanks! It doesn't seem to help though as the
compiler complains about it being not @nogc.
You probably need to declare the delegate and opApply() itself
On Wednesday, 22 June 2016 at 15:39:11 UTC, Meta wrote:
If it is called with 0 arguments it will return null. This
behaviour has caused several bugs in my code because combined
with optional parens and UFCS, it is easy to accidentally call
text with 0 args but have it look like passing a
On Tuesday, 21 June 2016 at 12:53:11 UTC, Adam D. Ruppe wrote:
On Tuesday, 21 June 2016 at 12:48:04 UTC, Gary Willoughby wrote:
I have no idea what that means. Can anyone shed more light on
this, please?
So when you use local variables in a delegate, the compiler
usually makes a copy of them
On Monday, 20 June 2016 at 15:27:32 UTC, Adam D. Ruppe wrote:
On Monday, 20 June 2016 at 15:13:53 UTC, Gary Willoughby wrote:
I think the problem is that the delegate which is required by
opApply is allocated using the GC.
make the delegate in opApply scope
int opApply(scope int
On Monday, 20 June 2016 at 15:47:44 UTC, Gary Willoughby wrote:
On Monday, 20 June 2016 at 15:27:32 UTC, Adam D. Ruppe wrote:
On Monday, 20 June 2016 at 15:13:53 UTC, Gary Willoughby wrote:
I think the problem is that the delegate which is required by
opApply is allocated using the GC.
make
On Monday, 20 June 2016 at 15:27:32 UTC, Adam D. Ruppe wrote:
On Monday, 20 June 2016 at 15:13:53 UTC, Gary Willoughby wrote:
I think the problem is that the delegate which is required by
opApply is allocated using the GC.
make the delegate in opApply scope
int opApply(scope int
On Monday, 20 June 2016 at 14:34:33 UTC, Mathias Lang wrote:
Can't `opApply` with `auto` return type works since it infers
attributes ?
I think the problem is that the delegate which is required by
opApply is allocated using the GC.
Is there any way to make opApply @nogc? or provide the same
foreach functionality without implementing a range interface?
I want to iterate over a piece of memory using a pointer. I
thought about using opSlice but that doesn't provide information
for an index in a foreach loop.
auto
When compiling, what exactly does the -betterC flag do? The
command help says "omit generating some runtime information and
helper functions" but what does this really mean? Is there any
specifics somewhere?
On Sunday, 19 June 2016 at 10:35:59 UTC, Gary Willoughby wrote:
...
A more correct example:
import core.stdc.stdlib;
import std.traits;
ref T foo(T)()
{
alias Type = Unqual!(T);
Type* foo = cast(Type*) malloc(Type.sizeof * 8);
return *foo;
}
void main(string[]
In the following code, the `foo` function doesn't work when
casting to an immutable or shared type. Can anyone please explain
what is happening here? Is there any way of returning such
variables byRef from a malloc'd chunk of memory?
import core.stdc.stdlib;
ref T foo(T)()
{
int* foo
I've tried the following code and I get the error:
Error: template Foo(A) does not have property 'of'
struct Foo(A)
{
private int _foo;
@disable this();
public this(int foo)
{
this._foo = foo;
}
public static auto of(B)()
1 - 100 of 612 matches
Mail list logo