Code::Blocks - Symbol View
I've installed the last version (12.11) but I see nothing inside the symbol view. What wrong? If I press "Ctrl + Alt + G" I get often the message that no functions could be parsed, or in some other files I see only a few of them. Can I improve this?
Re: Code::Blocks - Symbol View
On Friday, 27 September 2013 at 10:00:04 UTC, Namespace wrote: I've installed the last version (12.11) but I see nothing inside the symbol view. What wrong? If I press "Ctrl + Alt + G" I get often the message that no functions could be parsed, or in some other files I see only a few of them. Can I improve this? I had impression that D support in Code::Blocks has been kind of unmaintained for a long time.
Visual Studio - formatting
On Friday, 27 September 2013 at 10:06:31 UTC, Dicebot wrote: On Friday, 27 September 2013 at 10:00:04 UTC, Namespace wrote: I've installed the last version (12.11) but I see nothing inside the symbol view. What wrong? If I press "Ctrl + Alt + G" I get often the message that no functions could be parsed, or in some other files I see only a few of them. Can I improve this? I had impression that D support in Code::Blocks has been kind of unmaintained for a long time. You're right, I've switched to VS. But there I cannot set K&R for style bracketing. Am I forced to use the default style?
Re: Visual Studio - formatting
On Friday, 27 September 2013 at 11:16:51 UTC, Namespace wrote: You're right, I've switched to VS. But there I cannot set K&R for style bracketing. Am I forced to use the default style? No further answers, I am using vim :)
Re: drone.io for D
On Thursday, 26 September 2013 at 21:08:31 UTC, Daniel Davidson wrote: Is there an equivalent? Judging by link it looks like yet another continuous integration suite, is there anything more about it you are interested in? CI is usually not language-specific. If you are looking for one _written_ in D, though, only I am aware of is that runs CI for dmd/phobos (http://d.puremagic.com/test-results/) - https://github.com/braddr/d-tester (by Brad Roberts)
Re: drone.io for D
On Friday, 27 September 2013 at 11:22:43 UTC, Dicebot wrote: On Thursday, 26 September 2013 at 21:08:31 UTC, Daniel Davidson wrote: Is there an equivalent? Judging by link it looks like yet another continuous integration suite, is there anything more about it you are interested in? CI is usually not language-specific. If you are looking for one _written_ in D, though, only I am aware of is that runs CI for dmd/phobos (http://d.puremagic.com/test-results/) - https://github.com/braddr/d-tester (by Brad Roberts) drone.io is the first I've used (for Dart) and I think it is very useful. I am also working on D and did not find it as a supported language. I'm not particularly interested in one written in D as much as for D. I would think lobbying/helping the drone.io team or one of the others include D as a supported language would be doable. Or if there is another system that D users are using? Further, IMHO having many of the dub packages set up to run tests and display a *passing* badge would give a positive signal.
Re: drone.io for D
That is weird. I have used some common CI platforms like Jenkins for D projects with no issues. Those are simply irrelevant to actual language used. There must be something I am missing. Can you give quick summary what drone.io is actually about? It is not clear from their web site and I don't like to watch promo videos.
core/sys/windows/windows.d is executable
Hello all, While updating my DMD/druntime/phobos install from git HEAD, I noticed that the druntime file core/sys/windows/windows.d has executable permissions. Am I right to assume this is a mistake which probably stems from someone editing it _on Windows_, from whence all files seem to arrive on POSIX with executable permissions? I'll file a bug report & patch, but first thought I'd check I wasn't mistaken about this being a mistake. Thanks & best wishes, -- Joe
Re: drone.io for D
On Friday, 27 September 2013 at 11:52:46 UTC, Dicebot wrote: That is weird. I have used some common CI platforms like Jenkins for D projects with no issues. Those are simply irrelevant to actual language used. There must be something I am missing. Can you give quick summary what drone.io is actually about? It is not clear from their web site and I don't like to watch promo videos. To be clear it is not important to me that it be drone.io - again that is my first exposure to CI. But for Dart I have a github repository containing a package with a bunch of tests that succeed. I go to drone and create a project. In the process it offers to select any of my github repositories and then you select the language. A small script drives the *test* which is usually just something that runs calls out to your test scripts. The language you select allows the build to know what to do after cloning your repository before calling your test. So for the case of dart, it shows the version of dart being used (which they keep as the latest version), then it does a *pub install* which installs all your Dart package requirements, then it runs your tests. If they pass your badge, which is a link to the status of the latest build is green. Here is a sample badge for a json schema validator: https://drone.io/github.com/patefacio/json_schema/latest The nice thing is, any time you commit to github a build is automatically kicked off and you get notification of success/failure. I think the setup would work well with the right prereqs on the box and with dub replacing pub for installing dependencies. Maybe others are using something else - like Jenkins? It looks like julia has a fair amount of this done with Travis. So what does/should D users reach for?
Re: drone.io for D
On Friday, 27 September 2013 at 12:47:19 UTC, Daniel Davidson wrote: To be clear it is not important to me that it be drone.io - again that is my first exposure to CI. But for Dart I have a github repository containing a package with a bunch of tests that succeed. I go to drone and create a project. In the process it offers to select any of my github repositories and then you select the language. A small script drives the *test* which is usually just something that runs calls out to your test scripts. The language you select allows the build to know what to do after cloning your repository before calling your test. So for the case of dart, it shows the version of dart being used (which they keep as the latest version), then it does a *pub install* which installs all your Dart package requirements, then it runs your tests. If they pass your badge, which is a link to the status of the latest build is green. Here is a sample badge for a json schema validator: https://drone.io/github.com/patefacio/json_schema/latest The nice thing is, any time you commit to github a build is automatically kicked off and you get notification of success/failure. I think the setup would work well with the right prereqs on the box and with dub replacing pub for installing dependencies. Maybe others are using something else - like Jenkins? It looks like julia has a fair amount of this done with Travis. So what does/should D users reach for? Ah I see. Most often such software is run on own server and environment is fully controlled. For example, I am hosting Jenkins-based suite for Volt developers: https://jenkins.dicebot.lv Regarding CI as a public service, it still should be possible to use it with D if it supports job dependencies and has basic C/C++ tools available. You can always define build dmd/phobos job and make your project depend on it, with tiny bit of include path tweaking. That may be much more cumbersome than you want though. There are also some plans for doing automated CI for all projects located in dub registry. I have recently discussed this with Sonke (dub author) and going to try that at least with Linux build slave. Prototype may be available by the end of the autumn (rough terms). This is still not exactly dart.io though Easiest way here may be to simply convience https://travis-ci.org/ guys to add native D support - but I don't know how to approach them :)
Re: drone.io for D
P.S. all the github integration you are speaking about is pretty common among all CI software I am aware of, so it should be mostly hosting/environment issue for you.
Re: Visual Studio - formatting
On 27.09.2013 13:16, Namespace wrote: On Friday, 27 September 2013 at 10:06:31 UTC, Dicebot wrote: On Friday, 27 September 2013 at 10:00:04 UTC, Namespace wrote: I've installed the last version (12.11) but I see nothing inside the symbol view. What wrong? If I press "Ctrl + Alt + G" I get often the message that no functions could be parsed, or in some other files I see only a few of them. Can I improve this? I had impression that D support in Code::Blocks has been kind of unmaintained for a long time. You're right, I've switched to VS. But there I cannot set K&R for style bracketing. Am I forced to use the default style? Indentation is usually managed by the language service, I guess you have Visual D installed. Formatting in Visual D never adds or removed line breaks, so it should be compatible with almost any style that puts the closing brace on the same white space position as the statement that starts the block. That should include K&R. Could you give an example where it does not meet your expectation?
dmd -D == ouch!!
Hi all, While trying out David Simcha's std.rational (see: http://forum.dlang.org/post/mailman.1774.1380289646.1719.digitalmar...@puremagic.com and please offer feedback if this is of interest to you...), I tried building the docs and ran into the following amusing error message: $ dmd -D rational.d /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 1 has invalid symbol index 12 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 2 has invalid symbol index 2 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 3 has invalid symbol index 2 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 4 has invalid symbol index 11 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 5 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 6 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 7 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 8 has invalid symbol index 12 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 9 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 10 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 11 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 12 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 13 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 14 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 15 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 16 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 17 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 18 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 19 has invalid symbol index 21 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_line): relocation 0 has invalid symbol index 2 /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' collect2: error: ld returned 1 exit status --- errorlevel 1 Ouch, I think you'll agree! Of course, it only took a second's thought to realize that I should have used dmd -o- -D rational.d ... but the error message is pretty opaque. How feasible would it be to handle the case where the -D flag is passed with a nicer error message limiting itself to: (.text+0x20): undefined reference to `main' collect2: error: ld returned 1 exit status To build only documentation, use dmd -o- -D (I'd ask for it to just build the docs without erroring, but that would surely make for overlooked errors in some cases where you _should_ find main.) Thanks & best wishes, -- Joe
Re: Regex matching cause lots of _d_arrayliteralTX calls
27-Sep-2013 02:00, JR пишет: I'm working on a toy IRC bot. Much of the logic involved is translating the incoming raw IRC string into something that makes sense (so now I have two problems, etc). But I managed to cook up a regex that so far seems to work well. Time for callgrind! Grouped by source file, most time is spent in regex.d (as would seem natural) but more time is spent in gc.d than I would have expected. Looking at the callgraph I see that there's a curious amount of calls to _d_arrayliteralTX from (around) where the regex matching is done. (There's some inlining going on.) Example: http://dpaste.dzfl.pl/3932a231 (needs dmd head) And the answer is - don't use ENUM with ctRegex. The problem is that ctRegex returns you a pack of datastructures (=arrays). Using them with enum makes it behave as if you pasted them as array literals and these do allocate each time. TL;DR: use static and/or auto with ctRegex not enum. -- Dmitry Olshansky
Re: Regex matching cause lots of _d_arrayliteralTX calls
On Friday, 27 September 2013 at 14:37:05 UTC, Dmitry Olshansky wrote: 27-Sep-2013 02:00, JR пишет: And the answer is - don't use ENUM with ctRegex. The problem is that ctRegex returns you a pack of datastructures (=arrays). Using them with enum makes it behave as if you pasted them as array literals and these do allocate each time. TL;DR: use static and/or auto with ctRegex not enum. That fixed it. Thank you both for your help! (I was of the notion that that enum merely translate to compile-time-evaluated constants.)
Re: Regex matching cause lots of _d_arrayliteralTX calls
On Fri, Sep 27, 2013 at 04:52:20PM +0200, JR wrote: > On Friday, 27 September 2013 at 14:37:05 UTC, Dmitry Olshansky > wrote: > >27-Sep-2013 02:00, JR пишет: > > >And the answer is - don't use ENUM with ctRegex. The problem is that > >ctRegex returns you a pack of datastructures (=arrays). Using them > >with enum makes it behave as if you pasted them as array literals and > >these do allocate each time. > > > >TL;DR: use static and/or auto with ctRegex not enum. > > That fixed it. Thank you both for your help! > > > (I was of the notion that that enum merely translate to > compile-time-evaluated constants.) It does do that, yes. But the semantics aren't *quite* what one might expect (I was a victim of this misconception too :-P). What it does is to, in effect, "copy-n-paste" the value of the enum into whatever code uses it, every time. That means that if you write: enum x = "abc"; void fun() { auto y = x; } void gun() { auto z = x; } It will *copy* "abc" into y and z (rather than just aliasing the same underlying string), *each time* you call fun() and gun(). TL;DR: use immutable instead of enum for array-based constants: immutable x = "abc"; void fun() { auto y = x; } // now y is just an alias of x void gun() { auto z = x; } // now z is just an alias of x T -- Debian GNU/Linux: Cray on your desktop.
Re: Regex matching cause lots of _d_arrayliteralTX calls
27-Sep-2013 18:52, JR пишет: (I was of the notion that that enum merely translate to compile-time-evaluated constants.) I've recently investigated similar problem w.r.t. performance of std.regex on particular use-case/pattern. In fact it dig up an interesting bug with inlining in the compiler along the way. It took about 5 minutes to test that enum used instead of static devastates performance but quite some time to figure out the actual "infection chain". And indeed suspicious collections/d_array_literal is what I've seen in what supposed to be GC-free loop (callgrind is awesome). -- Dmitry Olshansky
fedora libcurl-gnutls issue
http://d.puremagic.com/issues/show_bug.cgi?id=10710 Does anyone know if there is there a workaround for this issue? Unfortunately Im stuck with fedora and cant jump to another OS... Thanks
Re: fedora libcurl-gnutls issue
On Friday, 27 September 2013 at 16:41:42 UTC, Joshua Niehus wrote: http://d.puremagic.com/issues/show_bug.cgi?id=10710 Does anyone know if there is there a workaround for this issue? Unfortunately Im stuck with fedora and cant jump to another OS... Thanks Option 1: Rebuild curl RPM with GnuTLS enabled. Option 2: Build Fedora DMD RPM on a Fedora box. Do not use the one from the web-site...
Re: fedora libcurl-gnutls issue
On Friday, 27 September 2013 at 16:41:42 UTC, Joshua Niehus wrote: http://d.puremagic.com/issues/show_bug.cgi?id=10710 Does anyone know if there is there a workaround for this issue? Unfortunately Im stuck with fedora and cant jump to another OS... Thanks Simply building dmd/phobos from git tag should result in proper linkage.
Re: core/sys/windows/windows.d is executable
On Friday, September 27, 2013 14:45:37 Joseph Rushton Wakeling wrote: > Hello all, > > While updating my DMD/druntime/phobos install from git HEAD, I noticed that > the druntime file core/sys/windows/windows.d has executable permissions. > > Am I right to assume this is a mistake which probably stems from someone > editing it _on Windows_, from whence all files seem to arrive on POSIX with > executable permissions? > > I'll file a bug report & patch, but first thought I'd check I wasn't > mistaken about this being a mistake. No, it should not be executable. The only time that it makes sense for a .d file to be executable is when it's a script with something like #!/bin/rdmd at the top, which certainly isn't the case for windows.d. - Jonathan M Davis
Re: Visual Studio - formatting
On Friday, 27 September 2013 at 13:47:21 UTC, Rainer Schuetze wrote: Could you give an example where it does not meet your expectation? Sure. 1. I cannot format the whole file 2. I have no setting to format automatically. 3. I have no symbol view. Or better: I see nothing there. And that is the most painfull thing.
Re: fedora libcurl-gnutls issue
On Friday, 27 September 2013 at 16:52:49 UTC, Dicebot wrote: Simply building dmd/phobos from git tag should result in proper linkage. Nothing is ever simple with me :) Thanks Dejan and Dicebot
Re: Visual Studio - formatting
3. I have no symbol view. Or better: I see nothing there. And that is the most painfull thing. That was my fault. I've deactivated the JSON output for some reason. On Friday, 27 September 2013 at 19:37:55 UTC, Namespace wrote: On Friday, 27 September 2013 at 13:47:21 UTC, Rainer Schuetze wrote: Could you give an example where it does not meet your expectation? Sure. 1. I cannot format the whole file 2. I have no setting to format automatically. Both still occur. Any chance to change that? Especially the last? Mono allow that and I really love it. That was one of my reasons last year, why I switched from VSD to Mono.
Re: Regex matching cause lots of _d_arrayliteralTX calls
On Friday, 27 September 2013 at 15:22:14 UTC, H. S. Teoh wrote: On Fri, Sep 27, 2013 at 04:52:20PM +0200, JR wrote: On Friday, 27 September 2013 at 14:37:05 UTC, Dmitry Olshansky wrote: >27-Sep-2013 02:00, JR пишет: >And the answer is - don't use ENUM with ctRegex. The problem >is that >ctRegex returns you a pack of datastructures (=arrays). >Using them >with enum makes it behave as if you pasted them as array >literals and >these do allocate each time. > >TL;DR: use static and/or auto with ctRegex not enum. That fixed it. Thank you both for your help! (I was of the notion that that enum merely translate to compile-time-evaluated constants.) It does do that, yes. But the semantics aren't *quite* what one might expect (I was a victim of this misconception too :-P). What it does is to, in effect, "copy-n-paste" the value of the enum into whatever code uses it, every time. That means that if you write: enum x = "abc"; void fun() { auto y = x; } void gun() { auto z = x; } It will *copy* "abc" into y and z (rather than just aliasing the same underlying string), *each time* you call fun() and gun(). I think strings are an actual exception to this rule, what with being immutable and all (provided you place the info in a string of course "char[] ss = s" will allocate of course). All other types, even immutable (AFAIK) will allocate though, yes.
ieeeFlags are not getting set.
Hi everyone, I am new to the D programming language and decided to use it for simple assignment. The idea is to compute the product of an arbitrary number of numbers and print the result in a specific way. The program needs to handle underflow/overflow, thus I decided to use ieeeFlags. The program is found below. Basically, the flags are not getting set. Changing the the if-statements to check whether the resulting value is infinity or 0 (to test respectively for overflow/underflow) and it works. So I am starting to think either I don't understand how this work, or there is a bug. Damien /**/ import std.stdio, std.exception, std.string, std.conv, std.math; void printProduct(in float[] numberList) { float tmp = 1.0f, product = 1.0f; int exponent = 0; foreach (number; numberList) { resetIeeeFlags(); tmp *= number; // The variable tmp is used to recover from errors. if (ieeeFlags.overflow) { writeln("lol"); while (product >= 1.0f) { product /= 10.0f; ++exponent; } product *= number; // Impossible to overflow anymore. tmp = product; } else if (ieeeFlags.underflow) { while (product <= 1.0f) { product *= 10.0f; --exponent; } product *= number; // Impossible to underflow anymore. tmp = product; } else { product = tmp; } } writeln(product, " times 10 to the power ", exponent, "."); } void main(string args[]) { float[] numberList; foreach (number; args[1..$]) { enforce(isNumeric(number), "Only numeric value are allowed as input."); numberList ~= to!float(number); } writeln("The product is:"); printProduct(numberList); }
Re: Server is not active?
On Fri, 27 Sep 2013 03:22:32 +0200, wagtail wrote: > A part of code shown below. > > /++ Server main() > / > ushort port = 9876; > > auto inet = new InternetAddress("0.0.0.0",port); > Socket server = new TcpSocket(inet.addressFamily()); > > bool flag = true; > > server.bind(inet); > server.listen(255); Is there any particular reason to use "0.0.0.0" creating your InternetAddress? I think it should be the ip of your server or just send port and ADDR_ANY will be used. >From Wikipedia: In the Internet Protocol version 4 the address 0.0.0.0 is a non-routable meta-address used to designate an invalid, unknown or non applicable target.
Re: Server is not active?
On Saturday, 28 September 2013 at 05:28:05 UTC, ollie wrote: On Fri, 27 Sep 2013 03:22:32 +0200, wagtail wrote: A part of code shown below. /++ Server main() / ushort port = 9876; auto inet = new InternetAddress("0.0.0.0",port); Socket server = new TcpSocket(inet.addressFamily()); bool flag = true; server.bind(inet); server.listen(255); Is there any particular reason to use "0.0.0.0" creating your InternetAddress? I think it should be the ip of your server or just send port and ADDR_ANY will be used. From Wikipedia: In the Internet Protocol version 4 the address 0.0.0.0 is a non-routable meta-address used to designate an invalid, unknown or non applicable target. Thank you for your reply! I thought ADDR_ANY is the same as "0.0.0.0",so I used it. This Server doesn't know ip of opponent client. I tried rewriting code with using "ADDR_ANY", but do not work...