On Wednesday, 17 July 2013 at 05:29:26 UTC, H. S. Teoh wrote:
On Wed, Jul 17, 2013 at 05:27:34AM +0200, JS wrote:
With heavy ctfe code generation usage is it possible to have
the d
compiler output the source code after all mixin templates have
been
"used"? This way it is easier to visually chec
On Wed, Jul 17, 2013 at 05:27:34AM +0200, JS wrote:
> With heavy ctfe code generation usage is it possible to have the d
> compiler output the source code after all mixin templates have been
> "used"? This way it is easier to visually check for errors in the
> generated code.
>
> I imagine one cou
On Wednesday, 17 July 2013 at 03:34:17 UTC, Timothee Cour wrote:
On Tue, Jul 16, 2013 at 8:29 PM, Timothee Cour
wrote:
On Tue, Jul 16, 2013 at 7:52 PM, JS wrote:
It seems that one must use two templates to process built in
times and
strings
template A(string a) { ... }
template A(a) { e
On Tue, Jul 16, 2013 at 8:29 PM, Timothee Cour wrote:
> On Tue, Jul 16, 2013 at 7:52 PM, JS wrote:
>
>>
>> It seems that one must use two templates to process built in times and
>> strings
>>
>> template A(string a) { ... }
>> template A(a) { enum A = A(typeof(a).stringof); }
>>
>> This is so we
On Tue, Jul 16, 2013 at 7:52 PM, JS wrote:
>
> It seems that one must use two templates to process built in times and
> strings
>
> template A(string a) { ... }
> template A(a) { enum A = A(typeof(a).stringof); }
>
> This is so we can do stuff like A!(double) and A!("double").
>
> The problem is
With heavy ctfe code generation usage is it possible to have the
d compiler output the source code after all mixin templates have
been "used"? This way it is easier to visually check for errors
in the generated code.
I imagine one could use pragma in a "special way" to do this but
I was hopin
On Tuesday, 16 July 2013 at 23:00:06 UTC, Namespace wrote:
static PriorityQueue opCall(T)() {
PriorityQueue!T po;
po.A = new T[DEFAULT_QueueSIZE];
po.num = 1;
return po;
}
Thanks a lot.
It seems that one must use two templates to process built in
times and strings
template A(string a) { ... }
template A(a) { enum A = A(typeof(a).stringof); }
This is so we can do stuff like A!(double) and A!("double").
The problem is when we have many parameters the number of
permutations i
OK, the code now works :-)
And the results are a bit hilarious:
...>md5_implementation5_dmd
md5 digest("") = D41D8CD98F00B204E9800998ECF8427E
zmd5 digest("") = D41D8CD98F00B204E9800998ECF8427E
Test performance / message size 200MBytes
digest(data) = F083432AB71F6177A8EC2CA5157F7B83
std.md5
But the code in that link is all wrong because it needs all the
code from std.md5 to work.
And even then I don't know where Decode() is.
OK, the code now works :-)
Bye,
bearophile
http://codepad.org/g4RBio8E
this line:
.replace("TT", "0x" ~ text(T(n), 16));
Needs to be:
.replace("TT", "0x" ~ to!string(T(n), 16));
But the code in that link is all wrong because it needs all the
code from std.md5 to work.
And even then I don't know where Decode() is.
Bye,
bearophile
static PriorityQueue opCall(T)() {
PriorityQueue!T po;
po.A = new T[DEFAULT_QueueSIZE];
po.num = 1;
return po;
}
On Tuesday, 16 July 2013 at 21:12:36 UTC, Ali Çehreli wrote:
On 07/16/2013 02:01 PM, Ali Çehreli wrote:
> On 07/16/2013 01:40 PM, JS wrote:
> > It would be nice if we had some way to data globally(in
module).
> >
> > e.g., __ctfestore["name"] = value;
>
> I would expect model-level objects s
This entry has stopped working since lot of time:
http://rosettacode.org/wiki/MD5/Implementation#D
This is an improved version, but help is welcome:
http://codepad.org/g4RBio8E
Bye,
bearophile
Hello, I am trying to using static opCall instead of the default
constructor.
When I run it, I got "Error: need 'this' to access member A".
How to fix it?
Here is my code.
struct PriorityQueue(T) {
static const int DEFAULT_QueueSIZE = 1;
T[] A;
int num;
On 07/16/2013 02:01 PM, Ali Çehreli wrote:
> On 07/16/2013 01:40 PM, JS wrote:
> > It would be nice if we had some way to data globally(in module).
> >
> > e.g., __ctfestore["name"] = value;
>
> I would expect model-level objects start their lives after the program
> starts running but their
On 07/16/2013 01:40 PM, JS wrote:
> The problem is I can't declare my "global" int variables directly inside
> the template. This does make it hard to use the same variable across
> multiple functions...
>
> template A
> {
> int c; // makes c near useless, can't use it like a normal it...
>
On Tuesday, 16 July 2013 at 14:05:38 UTC, Ali Çehreli wrote:
On 07/15/2013 10:51 PM, JS wrote:
> On Tuesday, 16 July 2013 at 04:37:33 UTC, Ali Çehreli wrote:
>> On 07/15/2013 08:43 PM, JS wrote:
>>
>> > http://dpaste.dzfl.pl/7c8b0ba9
>> >
>> > Why the heck can't we use integers in ctfe's? There
On Tuesday, July 16, 2013 21:37:13 Gary Willoughby wrote:
> Are associative arrays stable in D? I have to ask because i'm
> having a great deal of problems with them for simple operations.
> For example the following crashes.
>
> import std.stdio;
>
> void main(string[] args)
> {
> int[string] wa
Are associative arrays stable in D? I have to ask because i'm
having a great deal of problems with them for simple operations.
For example the following crashes.
import std.stdio;
void main(string[] args)
{
int[string] waiting;
waiting["gary"] = 1;
waiting["tess"] = 2;
On Tuesday, 16 July 2013 at 19:33:13 UTC, bearophile wrote:
The right, safe and readable way is to use std.array.empty:
if (myString.empty)
OMG, of course. Thanks!
Gary Willoughby:
What is the correct way to test for an empty string?
I've used
if (string == "")
and
if (string is null)
and both (O_o) in some places, it's starting to do my head in.
What is the correct way?
The right, safe and readable way is to use std.array.empty:
if (myString.empt
I just use
if(string.length == 0) {}
which covers both cases and is pretty intuitive too.
What is the correct way to test for an empty string?
I've used
if (string == "")
and
if (string is null)
and both (O_o) in some places, it's starting to do my head in.
What is the correct way?
On Tue, Jul 16, 2013 at 10:01 AM, Anthony Goins wrote:
> On Monday, 15 July 2013 at 06:46:52 UTC, timotheecour wrote:
>
>> On Monday, 15 July 2013 at 03:49:10 UTC, Timothee Cour wrote:
>>
>>> I'm trying to interact with a process using std.process and
>>> redirected stdin/stdout/stderr.
>>> What
On Monday, 15 July 2013 at 06:46:52 UTC, timotheecour wrote:
On Monday, 15 July 2013 at 03:49:10 UTC, Timothee Cour wrote:
I'm trying to interact with a process using std.process and
redirected stdin/stdout/stderr.
What would be the recommended way?
For example:
auto pipes=pipeShell("mypro
I could not find any posts on this and have not found a link on
the site about this either. It would be nice if there was a RSS
feed for the forum at least for the announce forum. It is very
difficult to monitor changes and updates with so much activity
just through the forum. Sorry if this
On Tuesday, 16 July 2013 at 13:58:10 UTC, Adam D. Ruppe wrote:
The reason I snipped the implementations here is the backend is
under a more restrictive license so I don't want to get into
copying that. But with just what I've said here combined with
guess+check against dmd's output it might be
On 2013-07-16 12:41, Jeremy DeHaan wrote:
This seems kind of strange to me, but when I go to specify a search
directory for the linker I can't seem to get it to work for a path that
contains spaces.
It's a known issue.
--
/Jacob Carlborg
On 07/15/2013 10:51 PM, JS wrote:
> On Tuesday, 16 July 2013 at 04:37:33 UTC, Ali Çehreli wrote:
>> On 07/15/2013 08:43 PM, JS wrote:
>>
>> > http://dpaste.dzfl.pl/7c8b0ba9
>> >
>> > Why the heck can't we use integers in ctfe's? There seems to
>> be no
>> > simple way to create a counter and this
On 07/15/2013 08:43 PM, JS wrote:
> http://dpaste.dzfl.pl/7c8b0ba9
>
> Why the heck can't we use integers in ctfe's?
That is false:
import std.range;
import std.algorithm;
import std.conv;
import std.stdio;
string makeCode(int begin, int end)
{
auto result = appender!string(`enum made = "`
Any chance:
-L+"C:\Users\Jeremy\Desktop\Search Directory\"
works?
Nope, same error.
I'm looking at the dmd source now...
The compression is done in the backend, file cgobj.c
The conditions are:
#define LIBIDMAX 128
if (len > LIBIDMAX)
{
// Attempt to compress the name
name2 = id_compress(name, len);
// snip
if (len2 > LIBIDMAX)// s
I'd like to dynamically load procedures from a dll in my app. To
load a symbol from a DLL i need it's mangled name. D currently
offers .mangleof which I currently use to generate the name. It
works very good, but only for short symbols. Is there any way to
get the final mangled name of a symbol
eles:
Don C.: "There's a root cause issue -- integer overflow is not
an error in general.
A good design for a modern language is to offer safe numbers on
default, and overflowing/modular integral types for the uncommon
cases where the programmer wants such behaviors.
Bye,
bearophile
eles:
Don C.: "There's a root cause issue -- integer overflow is not
an error in general. The paper which bearophile keeps posting,
which he has apparently never read, shows quite convincingly
that you cannot make it an error in a C-family language. There
are just too many legitimate uses of i
On Tuesday, 16 July 2013 at 11:14:44 UTC, bearophile wrote:
eles:
Bye,
bearophile
Don C.: "There's a root cause issue -- integer overflow is not an
error in general. The paper which bearophile keeps posting, which
he has apparently never read, shows quite convincingly that you
cannot make it a
On Tuesday, 16 July 2013 at 11:14:44 UTC, bearophile wrote:
eles:
Bye,
bearophile
Walter: "Consider all the addressing modes used - they are all
adds, with no overflow checks. Secondly, they all rely on
wraparound (overflow) arithmetic, after all, that is how
subtraction is done."
I think
On Tuesday, 16 July 2013 at 01:13:15 UTC, H. S. Teoh wrote:
On Mon, Jul 15, 2013 at 08:59:44PM -0400, Jonathan M Davis
wrote:
On Monday, July 15, 2013 14:48:08 Manfred Nowak wrote:
> Jonathan M Davis wrote:
> > gotos in such a context seem like a bit
> > of a nightmare to me though.
>
> I did r
On Tuesday, 16 July 2013 at 10:41:51 UTC, Jeremy DeHaan wrote:
This seems kind of strange to me, but when I go to specify a
search directory for the linker I can't seem to get it to work
for a path that contains spaces.
I tried to put quotes around the switch like I've done for
other switches
On Tuesday, 16 July 2013 at 10:37:59 UTC, eles wrote:
Isn't the promotion to int so awful? Better ideas? (yes, I know
about casting to long).
What do you mean, there is no promotion to int here.
eles:
Isn't the promotion to int so awful? Better ideas? (yes, I know
about casting to long).
Bug report/ER:
http://d.puremagic.com/issues/show_bug.cgi?id=4835
There is a pull request, but it's currently stalled:
http://d.puremagic.com/issues/show_bug.cgi?id=4835
Bye,
bearophile
On Tue, 16 Jul 2013 12:37:58 +0200, eles wrote:
$cat test.cpp:
#include
int main() {
long long x = 125000 * 2;
std::cout << x << std::endl;
return 0;
}
g++-generated exe displays: -1794967296
$cat test.d:
import std.stdio;
int main() {
long x = 125
This seems kind of strange to me, but when I go to specify a
search directory for the linker I can't seem to get it to work
for a path that contains spaces.
I tried to put quotes around the switch like I've done for other
switches, but when my program goes to link I get some strange
errors.
$cat test.cpp:
#include
int main() {
long long x = 125000 * 2;
std::cout << x << std::endl;
return 0;
}
g++-generated exe displays: -1794967296
$cat test.d:
import std.stdio;
int main() {
long x = 125000 * 2;
writefln("%d",x);
return 0
On Tuesday, 16 July 2013 at 07:19:05 UTC, Jacob Carlborg wrote:
The docs say: "Any intervening finally clauses are executed,
This does not solve:
/begin{ code}
markA:
if( exp1) goto markB;
if( exp2) goto markC;
...
scope ...
...
markB:
if( exp3) goto markA;
if( exp4) goto markC;
...
scope ..
On Monday, 15 July 2013 at 23:09:59 UTC, Joseph Rushton Wakeling
wrote:
On 07/16/2013 01:02 AM, H. S. Teoh wrote:
I generally use R 'cos it's less typing and I'm lazy
... ditto ... :-)
but Walter has been recently of the opinion that a more
descriptive name
is necessary for ddoc purposes, e.
On Tuesday, 16 July 2013 at 05:51:53 UTC, JS wrote:
...
Once again you post a complex and messy snippet and than jump to
wrong conclusions. This works:
template inc(int i)
{
enum inc = i + 1;
}
pragma(msg, inc!3);
Integers are treated normally in CTFE/templates, contrary to your
last
On Monday, 15 July 2013 at 17:39:43 UTC, H. S. Teoh wrote:
On Mon, Jul 15, 2013 at 07:32:37PM +0200, monarch_dodra wrote:
On Monday, 15 July 2013 at 15:54:57 UTC, bearophile wrote:
>monarch_dodra:
>
>>>But that (of new arrays) is a bad design, it wastes too much
>>>memory, and I think it should
AAAh !!
Got it !
I will make the switch !
Thanks a lot :)
Larry
On Tue, Jul 16, 2013 at 08:15:16AM +0200, Larry wrote:
> I have gdc 4.6 on Debian testing.
>
> Is that so old ?
That is extremely old. You want to get gdc-4.8.1 from unstable, if you
can. A great number of bugs have been fixed since gdc-4.6; in fact, the
entire std.regex has been replaced, which
On 2013-07-16 03:11, H. S. Teoh wrote:
My understanding is that goto translates directly to a jump in assembly,
so jumping in/out of blocks with declarations or stuff that needs
cleanups should immediately raise red flags. Of course, the compiler may
do something intelligent by inserting implici
52 matches
Mail list logo