Is this possible?
Example:
void foo(Args...)(auto ref Args args) {
sprintf(str.ptr, fmt.ptr, args);
}
On Sunday, 22 February 2015 at 17:20:23 UTC, Foo wrote:
On Sunday, 22 February 2015 at 17:15:06 UTC, anonymous wrote:
On Sunday, 22 February 2015 at 17:09:27 UTC, Foo wrote:
Is this possible?
Example:
void foo(Args...)(auto ref Args args) {
sprintf(str.ptr, fmt.ptr, args);
}
yes
On Sunday, 22 February 2015 at 17:15:06 UTC, anonymous wrote:
On Sunday, 22 February 2015 at 17:09:27 UTC, Foo wrote:
Is this possible?
Example:
void foo(Args...)(auto ref Args args) {
sprintf(str.ptr, fmt.ptr, args);
}
yes
I get the error, that I cannot pass a dynamic array
On Saturday, 21 February 2015 at 06:38:18 UTC, rumbu wrote:
Often I'm using the following code pattern:
class S
{
private SomeType cache;
public SomeType SomeProp() @property
{
if (cache is null)
cache = SomeExpensiveOperation();
return cache;
}
}
Is there any
On Saturday, 21 February 2015 at 15:26:28 UTC, ketmar wrote:
On Sat, 21 Feb 2015 08:27:13 +, rumbu wrote:
My question was not how I do this, I know already. My question
was if
there is another way to safely call a non-const instance
function on a
const object.
is there a way to been
On Saturday, 21 February 2015 at 14:39:47 UTC, anonymous wrote:
On Saturday, 21 February 2015 at 13:41:41 UTC, Foo wrote:
Finally, I tried to take your criticism objectively and, as
far as I can tell, I resolved the issues. Is there still any
objections or misconduct?
Nice. I think you fixed
On Friday, 13 February 2015 at 22:55:27 UTC, anonymous wrote:
On Thursday, 12 February 2015 at 23:52:41 UTC, Foo wrote:
This is something I've done recently.
Would be glad if my code will help you:
https://github.com/Dgame/m3
Especially the m3.d module could be useful for you.
/* Class and
On Friday, 13 February 2015 at 08:00:43 UTC, Kagamin wrote:
On Thursday, 12 February 2015 at 17:29:34 UTC, Foo wrote:
And since today it is @safe wherever possible.
Well, you marked functions @trusted rather indiscriminately :)
Such approach doesn't really improve safety, and the code could
On Friday, 13 February 2015 at 09:28:30 UTC, Kagamin wrote:
On Friday, 13 February 2015 at 09:11:26 UTC, Foo wrote:
And I wouldn't say indiscriminately. Every function I marked
with @trusted was checked by me so far.
What did you check them for? :)
Just first example: make and destruct, being
On Friday, 13 February 2015 at 22:55:27 UTC, anonymous wrote:
On Thursday, 12 February 2015 at 23:52:41 UTC, Foo wrote:
This is something I've done recently.
Would be glad if my code will help you:
https://github.com/Dgame/m3
Especially the m3.d module could be useful for you.
/* Class and
On Friday, 13 February 2015 at 23:13:05 UTC, anonymous wrote:
On Friday, 13 February 2015 at 23:04:25 UTC, Foo wrote:
Don't understand me wrong. My code is not perfect, but maybe
it can be helpful for someone.
As it is right now, I fear it may do more harm than good.
Always the same in this
On Thursday, 12 February 2015 at 23:27:51 UTC, Kitt wrote:
I'm currently trying to write a personal Associate Array class
that can be used in @nogc sections. Obviously, this means I'll
want to use malloc/free, however I'm not sure what the
Correct way to do this is. In a few places online I've
On Thursday, 12 February 2015 at 14:44:07 UTC, Kagamin wrote:
On Thursday, 12 February 2015 at 12:52:03 UTC, Andrey Derzhavin
wrote:
If we can't relay on GC wholly, there is no need for GC.
All of the objects, that I can create, I can destroy manually
by myself, without any doubtful GC
Since I'm now almost finished, I'm glad to show you my work:
https://github.com/Dgame/m3
You're free to use it or to contribute to it.
How can I do that without any GC allocation? Nothing in std.file
seems to be marked with @nogc
I'm asking since it seems very complicated to do that with C++,
maybe D is a better choice, then we would probably move our whole
project from C++ to D.
On Tuesday, 3 February 2015 at 19:56:37 UTC, FG wrote:
On 2015-02-03 at 20:50, Tobias Pankrath wrote:
Use std.utf.validate instead of decode. It will only allocate
one exception if necessary.
Looks to me like it uses decode internally...
But Foo, do you have to use @nogc? It still looks like
On Tuesday, 3 February 2015 at 19:44:49 UTC, FG wrote:
On 2015-02-03 at 19:53, Foo wrote:
How can I do that without any GC allocation? Nothing in
std.file seems to be marked with @nogc
I'm asking since it seems very complicated to do that with
C++, maybe D is a better choice, then we would
On Sunday, 1 February 2015 at 21:00:07 UTC, gedaiu wrote:
Hi,
I implemented Conway's game of life in D. What do you think that
I can improve to this program to take advantage of more D
features?
https://github.com/gedaiu/Game-Of-Life-D
Thanks,
Bogdan
For each remove you create a new array.
On Thursday, 8 January 2015 at 23:06:39 UTC, Nordlöw wrote:
On Thursday, 8 January 2015 at 16:11:07 UTC, ketmar via
Digitalmars-d-learn wrote:
how can it? compiler doesn't know what the code is supposed to
do. if
compilers will know such things someday, we can stop writing
programs
altogether,
On Friday, 9 January 2015 at 06:18:53 UTC, Jonathan M Davis via
Digitalmars-d-learn wrote:
On Friday, January 09, 2015 00:20:07 Foo via
Digitalmars-d-learn wrote:
On Thursday, 8 January 2015 at 23:06:39 UTC, Nordlöw wrote:
On Thursday, 8 January 2015 at 16:11:07 UTC, ketmar via
Digitalmars-d
Hi,
Could someone explain me, if and how it is possible to allocate a
variable length array with inline assembly?
Somewhat like
int[] arr;
int n = 42;
asm {
// allocate n stack space for arr
}
I know it is dangerous and all that, but I just want it know. ;)
On Wednesday, 17 December 2014 at 10:59:09 UTC, bearophile wrote:
Foo:
Hi,
Could someone explain me, if and how it is possible to
allocate a variable length array with inline assembly?
Somewhat like
int[] arr;
int n = 42;
asm {
// allocate n stack space for arr
}
I know it is
On Wednesday, 17 December 2014 at 12:15:23 UTC, uri wrote:
On Wednesday, 17 December 2014 at 11:39:43 UTC, Foo wrote:
On Wednesday, 17 December 2014 at 10:59:09 UTC, bearophile
wrote:
Foo:
Hi,
Could someone explain me, if and how it is possible to
allocate a variable length array with
And it is using malloc... ;)
I wanted something that increases the stack pointer ESP.
e.g.
void main()
{
int[] arr;
int n = 42;
writeln(arr.length);
writeln(arr.ptr);
asm {
mov EAX, n;
mov [arr + 8],
On Wednesday, 17 December 2014 at 16:10:40 UTC, Adam D. Ruppe
wrote:
On Wednesday, 17 December 2014 at 14:11:32 UTC, Foo wrote:
asm {
mov EAX, n;
mov [arr + 8], ESP;
sub [ESP], EAX;
mov [arr + 0], EAX;
}
but that
On Sunday, 28 September 2014 at 19:11:23 UTC, Jay wrote:
i want to chain 'new' with method calls on the created object.
i found this on the internet:
window.mainWidget = (new Button()).text(Hello
worldd).textColor(0xFF);
it would look much nicer with UFCS:
window.mainWidget =
On Saturday, 2 August 2014 at 20:38:59 UTC, David wrote:
Hi, not too sure if there's still someone reading this post,
but i do have another question. So, I heared so much good stuff
about D, it's powerfull, fast the syntax is nice, but well, why
is D actually not used for common games yet? (I
Hey guys. Can someone explain me, why this code does only works
with the inline assembler version but not with the mixin?
Thanks in advance!
Code:
import std.stdio : writeln;
import std.conv : to;
template Vala(uint count, alias arr) {
immutable string c = to!string(count);
For clarification: how would that work without mixin + string?
On Sunday, 20 July 2014 at 14:44:07 UTC, sigod wrote:
On Sunday, 20 July 2014 at 14:18:58 UTC, Foo wrote:
template Vala(uint count, alias arr) {
immutable string c = to!string(count);
enum Vala = asm { sub ESP, ~ c ~ ; mov ~ arr.stringof ~
,
~ c ~ ; mov ~ arr.stringof ~ + 4,
On Sunday, 20 July 2014 at 14:46:32 UTC, bearophile wrote:
enum Vala(uint count, alias arr) = format(
asm {
sub ESP, %d; // Reserve 'count' bytes
mov %s, %d; // Set a.length = 'count'
mov %s + 4, ESP; // Set a[0] to reserved bytes
}, count, arr.stringof,
On Sunday, 20 July 2014 at 14:55:00 UTC, Foo wrote:
For clarification: how would that work without mixin + string?
I tried this:
mixin template Vala2(uint count, alias arr) {
asm {
sub ESP, count;
mov arr, count;
mov arr + 4, ESP;
On Sunday, 20 July 2014 at 15:54:15 UTC, bearophile wrote:
mixin template Vala2(uint count, alias arr) {
What about disallowing mixin templatename unless you add
mixin before the template keyword?
Bye,
bearophile
I do not understand?
33 matches
Mail list logo