On Wednesday, 11 July 2012 at 06:34:29 UTC, Tobias Pankrath wrote:
This escapes a stack reference.
Ins't b supposed to be allocated on the heap?
The Bar instance is, but the pointer to it is not. Making _b a
Rebindable instead of using a pointer (to what effectively is a
pointer to the real
On Wednesday, July 11, 2012 08:34:28 Tobias Pankrath wrote:
> > This escapes a stack reference.
>
> Ins't b supposed to be allocated on the heap?
The object is. The reference is not. &b is taking the address of the
reference, not the object.
- Jonathan M Davis
This escapes a stack reference.
Ins't b supposed to be allocated on the heap?
On 07/11/2012 04:25 AM, ixid wrote:
in some way it sees global immutables almost as enums
This seems like a bad idea. Consistency of behaviour would seem to be a
good principle to expect of a language.
You are right; this is a bug.
in some way it sees global immutables almost as enums
This seems like a bad idea. Consistency of behaviour would seem
to be a good principle to expect of a language.
On 07/11/2012 12:58 AM, Ali Çehreli wrote:
On 07/10/2012 03:53 PM, Namespace wrote:
const(T)* ?
Example?
class Bar
{}
class Foo
{
const(Bar) * _b;
void SetBar(const(Bar) * b) {
_b = b;
}
}
void main()
{
auto b = new Bar();
auto f = new Foo();
f.SetBa
class Bar
{}
class Foo
{
const(Bar) * _b;
void SetBar(const(Bar) * b) {
_b = b;
}
}
void main()
{
auto b = new Bar();
auto f = new Foo();
f.SetBar(&b);
}
Ali
Hmm... That's good. Thanks.
On 07/10/2012 03:53 PM, Namespace wrote:
const(T)* ?
Example?
class Bar
{}
class Foo
{
const(Bar) * _b;
void SetBar(const(Bar) * b) {
_b = b;
}
}
void main()
{
auto b = new Bar();
auto f = new Foo();
f.SetBar(&b);
}
Ali
const(T)* ?
Example?
On Tuesday, 10 July 2012 at 19:27:56 UTC, Namespace wrote:
Maybe D need's a readonly keyword.
Sometimes i have a class which can take an object from
everywhere to store it. So it can not be const, because i
didn't just initialized it with a ctor.
But i don't want to change the object, i only wa
On Tue, 10 Jul 2012 21:27:54 +0200, Namespace
wrote:
Maybe D need's a readonly keyword.
Sometimes i have a class which can take an object from everywhere to
store it. So it can not be const, because i didn't just initialized it
with a ctor.
But i don't want to change the object, i only wa
Maybe D need's a readonly keyword.
Sometimes i have a class which can take an object from
everywhere to store it. So it can not be const, because i didn't
just initialized it with a ctor.
But i don't want to change the object, i only want to read or
call const methods. What now?
I'd suggest a
Let suppose I'm writing a library for Win32 applications called
"mylibrary".
The code of a program, called "UserProgram", that uses this
library would be like this:
UserProgram.d:
import mylibrary;
import std.c.windows.windows;
int WinMain(HINSTANCE hInst,HINSTANCE hPrevInst,LPSTR cmdLine,int
Let suppose I'm writing a library for Win32 applications, called
"mylibrary".
A program, called "UserProgram", that uses this library would be
like this:
UserProgram.d:
import mylibrary;
import std.c.windows.windows;
int WinMain(HINSTANCE hInst,HINSTANCE hPrevInst,LPSTR cmdLine,int
cmdShow)
{
On Sunday, 8 July 2012 at 22:10:32 UTC, bearophile wrote:
When tmp1 is defined globally, dmd is doing something
different, in some way it sees global immutables almost as
enums... I don't know if this is present in D specs.
You see it well with this test program:
immutable int[] A = [1];
te
On 07/08/2012 11:47 PM, Lemonfiend wrote:
Hi,
I seem to have run into a strange error..
When I put tmp1 outside the main loop, it compiles fine and gives the
expected output.
When tmp1 is put inside the main loop, the compiler seems to get stuck
in a loop?
I've tested it on: http://dlang.org/in
On Sunday, 8 July 2012 at 22:10:32 UTC, bearophile wrote:
When tmp1 is defined globally, dmd is doing something
different, in some way it sees global immutables almost as
enums... I don't know if this is present in D specs.
You see it well with this test program:
immutable int[] A = [1];
te
On 07/10/2012 04:14 PM, Andrea Fontana wrote:
Simple template:
T test(T)() { return T.init; }
This code give error:
int myVar;
myVar = test();
Why? Can't compiler guess T == int?
Type deduction only proceeds in the direction the data flows.
Reversing this process would in principle work i
Simple template:
T test(T)() { return T.init; }
This code give error:
int myVar;
myVar = test();
Why? Can't compiler guess T == int?
19 matches
Mail list logo