Hello.
I'm new to D and I stumbled upon something strange about readf while writing
some test code.
The code:
import std.stream;
import std.stdio;
int main(char[][] args)
{
string input = "2abc";
auto memstream = new TArrayStream!(string)(input);
int x;
memstrea
Hello.
Consider this code
void main()
{
l:
{
int v;
}
v = 5; // ok, v is defined
}
As I understand from D's grammar this behaviour is not a bug as
LabeledStatement:
Identifier : NoScopeStatement
and NoScopeStatement in turn takes BlockStatement without creating new
scope.
It
On Mon, 15 Nov 2010 19:34:46 +0300, Ellery Newcomer
wrote:
My gut feeling is that the if statement's behavior is wrong and the
while statement's is correct, but it could go either way.
I agree, I think case with 'when' works as specs say.
No need for a rationale for what can be adequately
pointsTo() tries to check every member of anonymous union inside struct.
import std.exception;
union U
{
int i;
string s;
}
struct S1
{
int type;
U u;
}
struct S2
{
int type;
union {
int i;
string s;
}
}
v
On Sun, 12 Dec 2010 22:36:03 +0300, Nick Voronin wrote:
pointsTo() tries to check every member of anonymous union inside struct.
alias this makes a passable workaround though. (I hope) :)
union U
{
int i;
string s;
}
struct S3
{
int type;
U u
On Mon, 13 Dec 2010 11:24:48 +0300, spir wrote:
I have a strange bug with an input range interface. Initially, I had a
(rather big) struct called Text with loads of working unittests. When
adding a range interface, noting worked anymore, any test ran into an
infinite loop (the terminal wri
On Mon, 13 Dec 2010 21:43:33 +0300, spir wrote:
I use rdmd for quick testing (because it links automagically).
compile: dmd -w -c filename.d
build: rdmd -w -offilename" -debug -unittest --build-only filename.d
Thanks. I missed -of option.
--
Using Opera's revolutionary email client: http://w
On Wed, 15 Dec 2010 13:28:56 +0300, spir wrote:
s...@o:~/prog/d$ dmd -ofprog -w -debug -unittest -L--export-dynamic
prog.d
s...@o:~/prog/d$ ./prog
core.exception.rangeer...@prog(20): Range violation
./prog(_d_array_bounds+0x16) [0x807cad6]
./prog(_D4prog7__arrayZ+0x12) [0x807
try -of option.
On Wed, 15 Dec 2010 21:59:32 +0300, CrypticMetaphor
wrote:
Hello, I'm having a bit of trouble with rdmd. rdmd puts the executable
in a temp folder, even with the --build-only option. Maybe this is a
silly question but, how can I compile with rdmd so I get the executable
nd up in cyberspace. :-)
Nope, there isn't :) In ordinary multitasking environment there is no guarantee
on upper bound.
--
Nick Voronin
) causes setting of
hardware timer? In every OS? In every minor version of OS even? If not (and I'm
pretty sure it's not so), then you need to add more details. All about how
scheduler works. Or this precise talk on what happen after time is up would
just mislead people. Aside from the fact that sometime after time is up thread
would become runnable again (which is really obvious, no?) there is nothing to
say.
--
Nick Voronin
uctor (as opposed to an opcall?)
Yes, and more. http://www.digitalmars.com/d/2.0/struct.html
--
Nick Voronin
In _some_ circumstances, it can catch escaping pointers
> and references, but in the general case, it can't.
In _general_ case there is no safety in D. With all low-level capabilities one
can always defeat compiler. Removing intermediate-level safer (yet unsafe)
capabilities arguabily gains nothing but frustration. I'm all for encouraging
good practices, but this is different.
--
Nick Voronin
replace current dir with the dir where source is, but it will take
away control), but this works.
There is a bug though, I can't make it work with -Irelative_path_to_src. Looks
like .deps contain paths relative to where rdmd was ran, while dmd interprets
them as paths relative to where .deps file is.
--
Nick Voronin
On Sun, 19 Dec 2010 17:26:20 -0800
Jonathan M Davis wrote:
> On Sunday 19 December 2010 16:50:34 Nick Voronin wrote:
> > On Sun, 19 Dec 2010 14:38:17 -0800
> >
> > Jonathan M Davis wrote:
> > > On Sunday 19 December 2010 14:26:19 bearophile wrote:
> > > &
so I wonder
> if there's a difference between "enum ubyte[]" and "enum ubyte[30]"?
One is fixed size array and other is dynamic. Honestly I doubt that it matters
for code generated by Ragel, since this is constant and won't be passed around.
If it's harder to make it fixed-size then don't bother.
--
Nick Voronin
s are directly embedded in
code.
In fact as long as you only access its elements (no passing array as an
argument, no assignment to another variable and no accessing .ptr) there is no
array object at all. If you do -- new object is created every time you do. I
believe Ragel doesn't generate code which passes tables around, so it doesn't
matter.
--
Nick Voronin
On Mon, 20 Dec 2010 05:43:08 -0500
bearophile wrote:
> Nick Voronin:
>
> > Here is where we diverge. Choosing struct vs class on criteria of their
> > placement makes no sense to me.
>
> In D you use a class if you want inheritance or when you (often) need
> refer
18 matches
Mail list logo