@Simen:
Thanks a lot, That solved the problem :).
@Ali:
:s I'm confused, some of the readers has got the attachment correctly :s
Jonathan M Davis Wrote:
> > const int a=0;
> > *cast(int*)&a=1;
>
> There are so many reasons to cringe at that. Taking the address of a local
> variable is generally very dangerous. As long as the pointer doesn't escape
> and exist beyond the life the variable, then you're okay, but you often
On Fri, 25 Mar 2011 05:51:11 -, Ali Çehreli wrote:
On 03/24/2011 10:18 PM, Ishan Thilina wrote:
> Hi,
>
> I'm still new to D. I tried to implement a stack using templates. But
I get an
> "Access Violation" error when I try to run a test on the stack that I
made.The
> source code is
On 2011-03-25 01:50, bearophile wrote:
A little quiz for people here: guess the output of this little D2 program (it
compiles correctly and doesn't crash at run time, so it's a fair question):
import std.typecons: tuple;
import std.c.stdio: printf;
auto foo() {
printf("foo\n");
retu
On Wed, 23 Mar 2011 21:16:02 -, Jonathan M Davis
wrote:
There are tasks for which you need to be able to lex and parse D code.
To 100% correctly remove unit tests would be one such task.
Is that last bit true? You definitely need to be able to lex it, but
instead of actually parsing i
Jacob Carlborg:
> I would guess it prints the values of all the fields in the struct
> returned by "tuple".
That was of course my purpose, because tuples are a way to implement multiple
return values, and in some situations I want to print all the items of such
return tuple, on separated lines
On 03/25/2011 06:18 AM, Ishan Thilina wrote:
Hi,
I'm still new to D. I tried to implement a stack using templates. But I get an
"Access Violation" error when I try to run a test on the stack that I made.The
source code is attached with this mail. Can somebody please point out the
error of this c
On 03/25/2011 12:08 PM, Regan Heath wrote:
On Wed, 23 Mar 2011 21:16:02 -, Jonathan M Davis
wrote:
There are tasks for which you need to be able to lex and parse D code. To
100% correctly remove unit tests would be one such task.
Is that last bit true? You definitely need to be able to l
Oh, I found the problem... It's just me forgetting that my library has
to go before phobos to compile it. So right now it works perfectly!
Thanks!
spir wrote:
On 03/25/2011 12:08 PM, Regan Heath wrote:
On Wed, 23 Mar 2011 21:16:02 -, Jonathan M Davis
wrote:
There are tasks for which you need to be able to lex and parse D
code. To
100% correctly remove unit tests would be one such task.
Is that last bit true? You definitely need to
Ishan Thilina Wrote:
> Hi,
>
> I'm still new to D. I tried to implement a stack using templates. But I get an
> "Access Violation" error when I try to run a test on the stack that I made.The
> source code is attached with this mail. Can somebody please point out the
> error of this code?
In gene
On 2011-03-25 12:32, bearophile wrote:
Jacob Carlborg:
I would guess it prints the values of all the fields in the struct
returned by "tuple".
That was of course my purpose, because tuples are a way to implement multiple
return values, and in some situations I want to print all the items of
> Jonathan M Davis Wrote:
> > > const int a=0;
> > > *cast(int*)&a=1;
> >
> > There are so many reasons to cringe at that. Taking the address of a
> > local variable is generally very dangerous. As long as the pointer
> > doesn't escape and exist beyond the life the variable, then you're okay,
> >
bearophile Wrote:
> A little quiz for people here: guess the output of this little D2 program (it
> compiles correctly and doesn't crash at run time, so it's a fair question):
>
>
> import std.typecons: tuple;
> import std.c.stdio: printf;
>
> auto foo() {
> printf("foo\n");
> return t
To empty many arrays of various types, rather than:
clear(arr1);
clear(arr2);
...
clear(arrN);
is there something like:
clear(ALL);
Also, after "clear(arr)", will "arr ~= value" assign starting from element 0?
On Fri, 25 Mar 2011 15:10:44 -0400, Dr.Smith wrote:
To empty many arrays of various types, rather than:
clear(arr1);
clear(arr2);
...
clear(arrN);
is there something like:
clear(ALL);
Not sure what this would do. Clear all arrays? That isn't possible.
Also, after "clear(arr)", will "arr
"Regan Heath" wrote in message
news:op.vswbv8qj54x...@puck.auriga.bhead.co.uk...
> On Wed, 23 Mar 2011 21:16:02 -, Jonathan M Davis
> wrote:
>> There are tasks for which you need to be able to lex and parse D code.
>> To 100% correctly remove unit tests would be one such task.
>
> Is that
"Alexey Prokhin" wrote in message
news:mailman.2713.1300954193.4748.digitalmars-d-le...@puremagic.com...
>> Currently, as far as I know, there are only two lexers and two parsers
>> for
>> D: the C++ front end which dmd, gdc, and ldc use and the D front end
>> which
>> ddmd uses and which is ba
"Andrej Mitrovic" wrote in message
news:mailman.2696.1300895928.4748.digitalmars-d-le...@puremagic.com...
> On 3/23/11, Jonathan M Davis wrote:
>> That would require a full-blown D lexer and parser.
>>
>> - Jonathan M Davis
>>
> Isn't DDMD written in D? I'm not sure about how finished it is thou
"Nick Sabalausky" wrote in message
news:imivp7$2fu$1...@digitalmars.com...
> "Alexey Prokhin" wrote in message
> news:mailman.2713.1300954193.4748.digitalmars-d-le...@puremagic.com...
>>> Currently, as far as I know, there are only two lexers and two parsers
>>> for
>>> D: the C++ front end wh
"Jonathan M Davis" wrote in message
news:mailman.2700.1300915109.4748.digitalmars-d-le...@puremagic.com...
>> On 3/23/11, Jonathan M Davis wrote:
>> > That would require a full-blown D lexer and parser.
>> >
>> > - Jonathan M Davis
>>
>> Isn't DDMD written in D? I'm not sure about how finished i
T[3] data;
T dot(const ref Vector o){
return data[0] * o.data[0] + data[1] * o.data[1] + data[2] * o.data[2];
}
T LengthSquared_Fast(){ return data[0] * data[0] + data[1] * data[1] +
data[2] * data[2]; }
T LengthSquared_Slow(){ return dot(this); }
The faster LengthSquared() is twice as fast
On 2011-03-25 19:04, Caligo wrote:
> T[3] data;
>
> T dot(const ref Vector o){
> return data[0] * o.data[0] + data[1] * o.data[1] + data[2] * o.data[2];
> }
>
> T LengthSquared_Fast(){ return data[0] * data[0] + data[1] * data[1] +
> data[2] * data[2]; }
> T LengthSquared_Slow(){ return dot(t
On Fri, Mar 25, 2011 at 10:49 PM, Jonathan M Davis wrote:
> On 2011-03-25 19:04, Caligo wrote:
>> T[3] data;
>>
>> T dot(const ref Vector o){
>> return data[0] * o.data[0] + data[1] * o.data[1] + data[2] * o.data[2];
>> }
>>
>> T LengthSquared_Fast(){ return data[0] * data[0] + data[1] * data[
On 2011-03-25 21:21, Caligo wrote:
> On Fri, Mar 25, 2011 at 10:49 PM, Jonathan M Davis
wrote:
> > On 2011-03-25 19:04, Caligo wrote:
> >> T[3] data;
> >>
> >> T dot(const ref Vector o){
> >> return data[0] * o.data[0] + data[1] * o.data[1] + data[2] *
> >> o.data[2]; }
> >>
> >> T LengthSq
On 3/25/2011 3:34 AM, Regan Heath wrote:
FYI.. that's uuencoded data:
http://en.wikipedia.org/wiki/Uuencoding
it's one of the older style encodings used by NNTP. Most readers should
support it.
Oddly enough, Thunderbird is one that doesn't.
26 matches
Mail list logo