struct S
{
}
void f(S)
{
}
void main()
{
S s;
with (s)
{
f(); // compiler error
}
}
Rather disappointing that this fails. Anyone know if this is an
expected limitation of UFCS or a bug?
--rt
On Tuesday, 11 June 2013 at 16:37:18 UTC, denizzz wrote:
On Tuesday, 11 June 2013 at 11:22:15 UTC, bearophile wrote:
denizzz:
This message looks weird. I am spent hour to find this bug.
:-(
Why aren't you just using code like this?
sfTime r = sfClock_getElapsedTime(sfPtr);
return Time(r);
Hey guys,
I have something I am curious about, but haven't had much luck
with when doing research and experimenting.
Basically, I am working with a library that uses ostreams
internally and I want to somehow redirect that to what ever
stderr is pointing to.
The reason I am trying to do thi
A typical COM server would create a new object (derived from
IUnknown), return it to the caller (potentially written in other
languages). Because the object pointer now resides outside of D's
managed heap, does that mean the object will be destroyed when
the GC runs? A normal COM object written
On Tue, 11 Jun 2013 20:58:17 -0400, Ali Çehreli wrote:
On 06/11/2013 05:48 PM, captaindet wrote:
> i think part of the problem is that '1' is an int. so the calculation
> must be promoted to integer.
No, the compiler knows that 1 could fit in a ubyte. It has
value-range-propagation. Ch
On Wednesday, 12 June 2013 at 02:01:27 UTC, denizzz wrote:
On Wednesday, 12 June 2013 at 01:17:50 UTC, Mike Parker wrote:
On Tuesday, 11 June 2013 at 16:37:18 UTC, denizzz wrote:
Ok, but why compiler says that types of these types is equal?
...that typeids of these types are equal?
On Wednesday, 12 June 2013 at 01:17:50 UTC, Mike Parker wrote:
On Tuesday, 11 June 2013 at 16:37:18 UTC, denizzz wrote:
sfTime* r = sfClock_getElapsedTime(sfPtr);
says what sfTime can not be implictly converted to sfTime
sfClock_getElapsedTime does not return a pointer.
You're going to con
On Wednesday, 12 June 2013 at 01:35:47 UTC, Adam D. Ruppe wrote:
// byte multiplication, answer goes into a 16 bit register,
but we could truncate it too
BTW just as a personal note you might be amused by, this multiply
instruction beat the crap out of me when I was learning x86
assembly ba
On Wednesday, 12 June 2013 at 00:58:17 UTC, Ali Çehreli wrote:
The CPU would have to have special registers to do those
operations in. (I am under the impression that x86 does not
have any arithmetic registers for types narrower than int.)
It does, for 8, 16, 32, and 64 bits. Here's how 8 and
On Tuesday, 11 June 2013 at 16:37:18 UTC, denizzz wrote:
sfTime* r = sfClock_getElapsedTime(sfPtr);
says what sfTime can not be implictly converted to sfTime
sfClock_getElapsedTime does not return a pointer.
You're going to continue to have type mismatches because you are
trying to use two
On 06/11/2013 05:48 PM, captaindet wrote:
> i think part of the problem is that '1' is an int. so the calculation
> must be promoted to integer.
According to "Integer Promotions" and "Usual Arithmetic Conversions"
there is no arithmetic operation that is executed in any type narrower
than int:
On 2013-06-11 07:35, Adam D. Ruppe wrote:
On Tuesday, 11 June 2013 at 10:12:27 UTC, Temtaime wrote:
ubyte k = 10;
ubyte c = k + 1;
This code fails to compile because of: Error: cannot implicitly
convert expression (cast(int)k + 1) of type int to ubyte
The reason is arithmetic operations trans
On Tuesday, 11 June 2013 at 22:13:18 UTC, bearophile wrote:
If you want to do benchmarks don't forget to do them with a
better compiler, like LDC2, that is able to use that
compile-time information to optimize better.
When I have written that code I was using only DMD. I have just
started t
Craig Dillabaugh:
If I had been coding this I would almost certainly have passed
the splitting dimensions as a function parameter, since the
compiler has to generate separate makeTree/findMedian functions
for each dimension that i/idx takes in the program.
So my question is, does anyone have an
On Tuesday, 11 June 2013 at 21:26:35 UTC, John Colvin wrote:
On Tuesday, 11 June 2013 at 20:46:32 UTC, Craig Dillabaugh
wrote:
I was looking at D code for constructing kd-trees, the full
code
listing for which can be found here:
clip
So my question is, does anyone have any idea why the aut
On Tuesday, 11 June 2013 at 20:46:32 UTC, Craig Dillabaugh wrote:
I was looking at D code for constructing kd-trees, the full code
listing for which can be found here:
http://rosettacode.org/wiki/K-d_tree#Faster_Alternative_Version
Of particular interest were the following functions:
KdNode* m
I was looking at D code for constructing kd-trees, the full code
listing for which can be found here:
http://rosettacode.org/wiki/K-d_tree#Faster_Alternative_Version
Of particular interest were the following functions:
KdNode* makeTree(size_t dim, size_t i)(KdNode[] nodes) pure
nothrow {
i
On Monday, 10 June 2013 at 02:02:09 UTC, Timothee Cour wrote:
UFCS chains are problematic when a symbol is ambiguous (eg
after import
std.stdio:write;import std.file:write);
I previously suggested to add the syntax
'arg1.(std.file.write)(arg2)'
(see 'support UFCS with fully qualified function n
I was listening to one of the DConf sessions and where was some
talk about implementing async from C# into D someday in the far
future. Recently I learned about D's fibers... and it looks like
the same thing to me. What are the major differences in principle?
-Jonathan
@jonathanAdunlap
On Tuesday, 11 June 2013 at 18:47:08 UTC, timotheecour wrote:
On Monday, 10 June 2013 at 08:13:42 UTC, John Colvin wrote:
On Monday, 10 June 2013 at 02:02:09 UTC, Timothee Cour wrote:
UFCS chains are problematic when a symbol is ambiguous (eg
after import
std.stdio:write;import std.file:write)
On Tuesday, 11 June 2013 at 19:09:11 UTC, Timothee Cour wrote:
wouldn't it be a better and more consistent idea to implement
bearophile's 'Compiler support to implement efficient safe
integrals'
http://d.puremagic.com/issues/show_bug.cgi?id=9850 so uint/int
etc would require no cast
This isn'
I think selective, renamed imports are much better.
On Monday, 10 June 2013 at 02:02:09 UTC, Timothee Cour wrote:
* library solution, already works, no need to add new syntax
* avoids the renamed local imports, which I argue is a bad idea
(makes it
harder to search for usages of a function, ie
On Tue, Jun 11, 2013 at 11:26 AM, H. S. Teoh wrote:
> On Tue, Jun 11, 2013 at 01:25:24PM -0400, Steven Schveighoffer wrote:
> > On Tue, 11 Jun 2013 12:18:52 -0400, Adam D. Ruppe
> > wrote:
> >
> > >On Tuesday, 11 June 2013 at 16:05:30 UTC, Steven Schveighoffer wrote:
> > >>CPU performs math at i
On Monday, 10 June 2013 at 08:13:42 UTC, John Colvin wrote:
On Monday, 10 June 2013 at 02:02:09 UTC, Timothee Cour wrote:
UFCS chains are problematic when a symbol is ambiguous (eg
after import
std.stdio:write;import std.file:write);
I previously suggested to add the syntax
'arg1.(std.file.wri
On Tue, Jun 11, 2013 at 01:25:24PM -0400, Steven Schveighoffer wrote:
> On Tue, 11 Jun 2013 12:18:52 -0400, Adam D. Ruppe
> wrote:
>
> >On Tuesday, 11 June 2013 at 16:05:30 UTC, Steven Schveighoffer wrote:
> >>CPU performs math at int level.
> >
> >eh, I wouldn't blame the hardware. You can do
>
On Tuesday, 11 June 2013 at 17:41:59 UTC, Mike Wey wrote:
On 06/11/2013 05:56 PM, Alex Horvat wrote:
TreeStore store = cast(TreeStore)tvTreeView.getModel();
In this case store == null
I think that one should work, how are you setting/creating the
TreeStore?
tvTreeView.setModel(CreateModel()
On 06/11/2013 05:56 PM, Alex Horvat wrote:
TreeStore store = cast(TreeStore)tvTreeView.getModel();
In this case store == null
I think that one should work, how are you setting/creating the TreeStore?
--
Mike Wey
I don't know your setup but you should usually get some linker
error when not linking against the gtkd libraries.
Also your first post whould suggest you are using Windows while
-L-ldl would link in the Linux dynamic linker.
I am using Windows, but adding those thingamajigs still solves
the
On 06/11/2013 03:33 PM, Daemon wrote:
I've been checking stack overflow and some blogs and kept trying various
things. I finally managed to launch it normally. For anyone who might
have had the same problem, the solution is to pass "-L-lgtkd -L-ldl" to
the command line.
Project -> Properties ->
On Tue, 11 Jun 2013 12:18:52 -0400, Adam D. Ruppe
wrote:
On Tuesday, 11 June 2013 at 16:05:30 UTC, Steven Schveighoffer wrote:
CPU performs math at int level.
eh, I wouldn't blame the hardware. You can do
asm {
mov AL, 10;
add AL, 5;
}
and it is allowed, it also don't spill into AH
On Tuesday, 11 June 2013 at 16:18:54 UTC, Adam D. Ruppe wrote:
I'd be extremely annoyed if that required a cast. It's bleeding
obvious that you want it to assign back there
To me u = u + k is as obvious as u += k, but that's probably not
a thing anyone would be much concerned about :)
C# compilers present bugs with a standard number, like:
myprog.cs(7,60): error CS1525: ...
This is useful because you can then write an explanation page
for each of those bugs, like CS1525:
http://msdn.microsoft.com/en-gb/library/3hdyz4dw%28v=vs.80%29.aspx
In such pages you can explain w
On Tuesday, 11 June 2013 at 11:22:15 UTC, bearophile wrote:
denizzz:
This message looks weird. I am spent hour to find this bug. :-(
Why aren't you just using code like this?
sfTime r = sfClock_getElapsedTime(sfPtr);
return Time(r);
sfTime* r = sfClock_getElapsedTime(sfPtr);
says what s
On Tuesday, 11 June 2013 at 16:09:39 UTC, Steven Schveighoffer
wrote:
On Tue, 11 Jun 2013 10:04:21 -0400, Eric
wrote:
The following code does not compile:
class Foo { int x; }
class Bar { static Foo f = new Foo(); } // compiler error
static Foo g = new Foo(); // compiler error
These can
On Tuesday, 11 June 2013 at 16:05:30 UTC, Steven Schveighoffer
wrote:
CPU performs math at int level.
eh, I wouldn't blame the hardware. You can do
asm {
mov AL, 10;
add AL, 5;
}
and it is allowed, it also don't spill into AH if you overflow it
(it just sets the carry flag). I'm sure it
On Tue, 11 Jun 2013 07:46:11 -0400, Temtaime wrote:
No. I means, that
uint a = uint.max;
uint b = a + 1;
writeln(b);
Works OK.
Why? Compiler doesn't know if a + b fits in uint, right?
Then why overflow with ints are accepted?
CPU performs math at int level. So even if you add two ubytes, t
On Tue, 11 Jun 2013 10:04:21 -0400, Eric wrote:
The following code does not compile:
class Foo { int x; }
class Bar { static Foo f = new Foo(); } // compiler error
static Foo g = new Foo(); // compiler error
These can be solved with a static ctor. Essentially, any static
initializers mu
On Tue, Jun 11, 2013 at 02:34:37PM +0200, Elvis wrote:
> On Monday, 10 June 2013 at 14:40:05 UTC, Kenji Hara wrote:
> >On Monday, 10 June 2013 at 09:42:56 UTC, Elvis wrote:
> >>class A
> >>{
> >> enum TypeID = 1;
> >>}
> >>class B : A
> >>{
> >> enum TypeID = 2;
> >>}
> >>
> >>class C : A
> >>{
I'm trying to get a TreeStore object back out of a TreeView in
GtkD.
The reason for this is so that I can change the value of a cell
in the TreeView - in this case changing one image for another.
I can't use a TreeModel for this as it does not have a setValue
function.
I've got this workin
Why aren't static class instances allowed? Is there a
work-around,
or alternative approach to this?
C# compilers present bugs with a standard number, like:
myprog.cs(7,60): error CS1525: ...
This is useful because you can then write an explanation page
for each of those bugs, like CS1
Eric:
The following code does not compile:
class Foo { int x; }
class Bar { static Foo f = new Foo(); } // compiler error
static Foo g = new Foo(); // compiler error
void main() {}
(dmd7) desk3:~/tp/d_test2/dlib>dmd T.d
T.d(4): Error: variable T.Bar.f is mutable. Only const or
immutable clas
The following code does not compile:
class Foo { int x; }
class Bar { static Foo f = new Foo(); } // compiler error
static Foo g = new Foo(); // compiler error
void main() {}
(dmd7) desk3:~/tp/d_test2/dlib>dmd T.d
T.d(4): Error: variable T.Bar.f is mutable. Only const or
immutable class threa
On Tuesday, 11 June 2013 at 08:08:03 UTC, denizzz wrote:
sfClock_getElapsedTime return type actually defined in the
another file, typeid =
_D45TypeInfo_S8derelict5sfml211systemtypes6sfTime6__initZ
compilation causes:
dsfml/system.d(54): Error: static assert (is(sfTime ==
sfTime)) is fals
I've been checking stack overflow and some blogs and kept trying
various things. I finally managed to launch it normally. For
anyone who might have had the same problem, the solution is to
pass "-L-lgtkd -L-ldl" to the command line.
Project -> Properties -> Command Line -> Additional Options.
On Tuesday, 11 June 2013 at 10:12:27 UTC, Temtaime wrote:
ubyte k = 10;
ubyte c = k + 1;
This code fails to compile because of: Error: cannot implicitly
convert expression (cast(int)k + 1) of type int to ubyte
The reason is arithmetic operations transform the operands into
ints, that's why t
On Monday, 10 June 2013 at 14:40:05 UTC, Kenji Hara wrote:
On Monday, 10 June 2013 at 09:42:56 UTC, Elvis wrote:
class A
{
enum TypeID = 1;
}
class B : A
{
enum TypeID = 2;
}
class C : A
{
enum TypeID = 3;
}
class D : B
{
enum TypeID = 4;
}
...
Could anybody shed some light on h
Temtaime:
Why? Compiler doesn't know if a + b fits in uint, right?
Then why overflow with ints are accepted?
It's an inconstancy based on practical considerations.
Walter decided that applying the same rule to uint/int/long
causes too many casts in normal problems.
And the range of a 32 bi
On Tue, 11 Jun 2013 13:46:11 +0200, Temtaime wrote:
No. I means, that
uint a = uint.max;
uint b = a + 1;
writeln(b);
Works OK.
Why? Compiler doesn't know if a + b fits in uint, right?
Then why overflow with ints are accepted?
Because there's a limit to how far this goes without introducing
No. I means, that
uint a = uint.max;
uint b = a + 1;
writeln(b);
Works OK.
Why? Compiler doesn't know if a + b fits in uint, right?
Then why overflow with ints are accepted?
So your example is meaningless.
On Tue, 11 Jun 2013 13:15:11 +0200, Simen Kjaeraas
wrote:
On Tue, 11 Jun 2013 12:39:47 +0200, Temtaime wrote:
There is overflow and it can be with int too.
It's standard behavior.
Indeed. And a class is a void* is an int is a char is a double? That's
perfectly possible - it's all just me
denizzz:
This message looks weird. I am spent hour to find this bug. :-(
Why aren't you just using code like this?
sfTime r = sfClock_getElapsedTime(sfPtr);
return Time(r);
I don't fully understand, it seems a diagnostic problem.
Please create a minimal test case that shows the problem. May
Temtaime:
ubyte k = 10;
ubyte c = k + 1;
This code fails to compile because of: Error: cannot implicitly
convert expression (cast(int)k + 1) of type int to ubyte
Why? It's pain in the ass, i think. My code contains only casts
then.
I agree that sometimes that's a pain.
Currently D perform
On Tue, 11 Jun 2013 12:39:47 +0200, Temtaime wrote:
There is overflow and it can be with int too.
It's standard behavior.
Indeed. And a class is a void* is an int is a char is a double? That's
perfectly possible - it's all just memory anyway. D has chosen to do
it like this to prevent common
There is overflow and it can be with int too.
It's standard behavior.
On Tue, 11 Jun 2013 12:12:25 +0200, Temtaime wrote:
ubyte k = 10;
ubyte c = k + 1;
This code fails to compile because of: Error: cannot implicitly convert
expression (cast(int)k + 1) of type int to ubyte
Why? It's pain in the ass, i think. My code contains only casts then.
Because it's u
ubyte k = 10;
ubyte c = k + 1;
This code fails to compile because of: Error: cannot implicitly
convert expression (cast(int)k + 1) of type int to ubyte
Why? It's pain in the ass, i think. My code contains only casts
then.
On Sat, 08 Jun 2013 05:52:49 +0100, Eric wrote:
On Saturday, 8 June 2013 at 02:32:57 UTC, bearophile wrote:
Eric:
Yes, the template constraint is much better. However, the compiler
still crashes, even with the new code:
Because there's a type definition loop, regardless. Using a constrai
On Friday, 31 May 2013 at 17:14:46 UTC, Shriramana Sharma wrote:
import std.stdio ;
void foo ( int[] array ) {
foreach ( i ; array ) { writeln ( i ) ; }
}
void main () {
foo ( [ 1, 2, 3 ] ) ;
}
On both DMD 2.062 and 2.063 this compiles OK but causes a
segfault.
I'm running Ku
Piece of code:
https://github.com/denizzzka/DSFML/blob/237a752988c76e3c2f63ed03ae12558823ce43ec/dsfml/system.d#L53
Time getElapsedTime() const
{
auto r = sfClock_getElapsedTime(sfPtr);
static assert( is (typeof(r) == sfT
59 matches
Mail list logo