On 08/24/2011 09:36 PM, Jonathan M Davis wrote:
On Wednesday, August 24, 2011 21:29:23 Timon Gehr wrote:
On 08/24/2011 09:21 PM, Andrej Mitrovic wrote:
On 8/24/11, Timon Gehrtimon.g...@gmx.ch wrote:
it is usually faster
in debug mode
Huh.. How come?
Well, not notably faster, but many
On 08/25/2011 12:47 AM, Mafi wrote:
Am 24.08.2011 21:04, schrieb Timon Gehr:
On 08/24/2011 08:04 PM, Andrej Mitrovic wrote:
Here's some code that iterates through parents of some class object
until it finds an object with no parent (where parent is null):
import std.stdio;
class Foo
{
Foo
On 08/22/2011 10:19 PM, Don wrote:
Timon Gehr wrote:
On 08/21/2011 09:10 PM, Don wrote:
bearophile wrote:
Sean Eskapp:
Oh, I see, thanks! This isn't documented in the function
documentation!
D purity implementation looks like a simple thing, but it's not
simple, it has several parts
On 08/20/2011 08:18 PM, Sean Eskapp wrote:
bearophile:
As far as I know they have decided to make memory overflow errors, so they are
not exceptions, you can't catch them. Other people will confirm this or not.
In this case, how would you go about handling out-of-memory situations? A
systems
On 08/19/2011 02:01 PM, useo6 wrote:
Hi,
I've create a little example of my problem:
module example;
class ExampleClass {
public {
int mi;
this(int i) {
mi = i;
}
}
}
int main(string[] args) {
On 08/16/2011 02:48 AM, mimocrocodil wrote:
subj
try compiling to 32 bit with the -m32 flag in non-release mode. afaik
the 64 bit compiler does not yet support core dumps.
(if you are actually compiling to 32 bit then I don't know why you don't
get a core dump and you'd have to provide
On 08/16/2011 07:53 PM, Klimov Max wrote:
Do�developers�plan�to�realize�compilation�to�coff�format�on�windows?
There�are�the�cases�when�i�have�to�use�visual�studio�compiler�that
generates�coff�object�files.�For�example,�CUDA�compiler�now�support
On 08/15/2011 03:47 PM, Steven Schveighoffer wrote:
On Fri, 12 Aug 2011 17:51:50 -0400, bearophile
bearophileh...@lycos.com wrote:
Steven Schveighoffer:
int main(in string[] args);
What would be the purpose of this?
Why do you use in in function arguments? To make sure you will not
On 08/15/2011 11:53 PM, Brad Roberts wrote:
On Mon, 15 Aug 2011, Timon Gehr wrote:
On 08/15/2011 03:47 PM, Steven Schveighoffer wrote:
On Fri, 12 Aug 2011 17:51:50 -0400, bearophile
bearophileh...@lycos.com wrote:
Steven Schveighoffer:
int main(in string[] args);
What would
On 08/13/2011 03:44 PM, bearophile wrote:
I'd like to create an empty heap, and then add to it an arbitrary (and
statically unknown) number of items, keeping the heap invariant valid all the
time (this means the heap invariant is valid after each item is added to the
heap, so I am free to pop
On 08/13/2011 01:04 AM, Adam Ruppe wrote:
Jonathan M Davis wrote:
const(T)[] maybe,
but as soon as you use in, you can't use any range functions.
That is, to me, the biggest problem with range functions and
something that should be fixed.
There's no defense for it aside from being the status
Andrei Mitrovic wrote:
Does anyone know why putting this alias in module scope errors out?:
import std.algorithm;
alias reduce!((a, b){ return 1; }) foo;
void main()
{
foo([1, 2, 3]);
}
Error: delegate test.__dgliteral1!(int,int).__dgliteral1 is a nested
function and cannot
be
Your example with reduced boilerplate code:
struct DVECTOR2 {
template Accepts(T){enum Accepts=is(T==DVECTOR2) || is(T==float) ||
is(T==D3DXVECTOR2) || is(T==POINT);}
template isScalar(T){enum isScalar=is(T==float);}
float x = 0f, y=0f;
this()(float x, float y) {
this.x = x;
this.y =
On Wed, 22 Jun 2011 00:02:55 +, Ali Çehreli wrote:
I wonder whether a UniqueRef object could be returned, which could allow
a single casting of its data to mutable or immutable at the call site.
Further casts could throw, but that would be a runtime solution. :-/
Further casts should
Steven Schveighoffer wrote:
https://github.com/D-Programming-Language/druntime/pull/29
See if that helps. On my system, your code now results in your expected
output.
-Steve
If the compiler optimizes well enough the output given could be valid (it might
construct the struct directly where
Lloyd Dupont wrote:
I'm using 2.053
this compile fine:
enum : string
{
A = hello,
B = betty,
}
this doesn't!
enum AA : string
{
A = hello,
B = betty,
}
Am I missing something? Named enum can't be typed? known bug?
It works just fine for me.
On 2011-06-10 19:56, Jonathan Sternberg wrote:
Why doesn't this work?
import std.stdio;
string copy_string(char [] input)
{
return input.dup;
}
int main()
{
char [] buf = ['h', 'e', 'l', 'l', 'o'];
writeln( copy_string(buf) );
}
I want to do something more complex. In
Renoir wrote:
Sorry for the question but i'm an absolutely noob
I have:
byte x = 10;
byte y = 3;
x = x + y;
why compilers complains?
Error: cannot implicitly convert expression (cast(int)x + cast(int)
y
) of type int to byte
Have i to make another cast to sum byte + byte?
Yes, the
Fabian wrote:
Dear D Community,
is it reasonable to learn D?
I've found a lot of good points for D but I've found a lot of negative
points too. I believe that I needn't to list all the point for D but I
want to give a few examples against learning D I've read in some German
and English
Fabian wrote:
The community does not grow if people stay away because it is small.
Thank you for your answer. - You've got a big point!
I don't know about this but I think QtD and DWT are still being
maintained?
I can't see any changes on this web page:
Andrej Mitrovic wrote:
On 6/6/11, Jonathan M Davis jmdavisp...@gmx.com wrote:
So, anything you do on your own could be polymorphic, but as soon as you
get ranges from Phobos, you lose the polymorphism.
Yeah, I've noticed that. I wouldn't want to loose the ability to call
into
I just found Project Euler, and tried to solve the first problem.
https://gist.github.com/1007840
simendsjo wrote:
I did four implementations: template, ctfe, parallel foreach and
parallel map.
The template implementation works on low numbers, but not on 1000
(haven't checked when it fails).
Nick Sabalausky:
In D2, I can treat a uint as an array of ubytes by doing this:
uint num = /+...whatever...+/;
ubyte[] = cast(ubyte[4])num;
How do I do that in D1?
Using a union is probably the safest way:
union Uint2Ubyte {
uint u;
ubyte[4] b;
}
By the way, this of type
Jonathan M Davis wrote:
On 2011-05-30 12:49, simendsjo wrote:
I'm having some problems trying to get the best of both worlds here.
void f(Class c) {
assert(c != null);
// use c
}
In this example, we tell the compiler that c is never able to be null.
The compiler can use assertions
Timon Gehr:
The answer is yes, theoretically it could. (It would either have to have
some very
advanced code analysis caps, or would just have to treat enforce specially.)
Id's not so advanced stuff.
Bye,
bearophile
You are saying that analyzing a function for thrown exceptions
see a good use case for it? And no,
porting C code isn't a good use case.
-Steve
There are no alias in C code.
I actually gave one:
Timon Gehr wrote:
alias int func();
int main(){
static assert(is(typeof(main)==func);
return 0;
}
You can use something similar
Steven Schveighoffer wrote:
On Mon, 23 May 2011 10:50:11 -0400, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
Since main can't be a template value argument, maybe he meant this use
case:
alias int func();
void foo(alias T)()
{
static assert(is(typeof(T) == int function())); //
Andrej Mitrovic wrote:
Should I file a bug report to kill this syntax?
No. It is perfectly valid, see grammar:
http://www.digitalmars.com/d/2.0/declaration.html
What is strange about this syntax in particular?
int i; //declares i of type int
alias int i; //defines i as type int
int func(int);
On 22/05/2011 16:20, Timon Gehr wrote:
Andrej Mitrovic wrote:
Should I file a bug report to kill this syntax?
No. It is perfectly valid, see grammar:
http://www.digitalmars.com/d/2.0/declaration.html
Grammar states only that it's syntactically valid, and makes no comment on
semantic
I am parsing some formulas from a spreadsheet file. To duplicate
the behavior of the spreadsheet functions, I am having to create a
lot of boiler plate code that maps from the spreadsheet functions
to the built-in functions. Mixin would seem to allow me to
automate the boiler-plate creation,
Hey guys,
is there any chance to create an abstract constructor like:
abstract class ABC {
abstract this();
}
DMD always says ...this non-virtual functions cannot be abstract -
when I use an interface like:
interface ABC {
this();
}
I get a similar error: ...constructors,
I have a question,
can I write all functions like this object.function() instead of
functin(object) ?
or that form for some function or cases.
This currently only works for D arrays. (I think WalterAndrei wanted it for
other
types too originally, I do not know if it will be implemented.)
I'm trying to understand the design of ranges. Why does popFront only set the
front() property to return the next element in the range? Why not return the
element in the call to popFront right away?
For example code like this (which doesn't work since popFront doesn't return):
void main()
{
Andrei Mitrovic:
Can the compiler optimize the second case and convert b.front to just
do one field access?
In simple cases, obviously yes:
import std.range;
import std.stdio;
void main(){
int[] a=new int[1000];
auto b=retro(retro(a));
writeln(b.front);
}
Produces:
.text:08094B64
Should the compiler optimise by computing n only once? (even possibly at
compile-time)
Then, what if I'm doing that in purpose? (be it stupid or not)
Denis
What is the difference? The only thing that is affected by this optimization is
execution speed. Optimizing is about implementing the
I just noticed a little oddity.
Why does this code compile? The equivalent C code is rejected:
import std.stdio;
//#include stdio.h
int main(){
int a,b;
do{
scanf(%d %d,a,b);
}while(ab) //note missing semicolon here
return 0;
}
The grammar specifies this correctly, but
1) T foo(T:SomeClass)(T arg){..}
It is specified on the main page that this template will match against
instantiations with a subclass of SomeClass. Will this also duplicate the
code? Or will the template work similar to the function T foo(SomeClass
arg){..}? If yes, why should normal functions
801 - 837 of 837 matches
Mail list logo