Re: Building 32bit program with MSVC?

2014-05-31 Thread Kagamin via Digitalmars-d-learn
They may use different debugging formats, but just linking should be possible, especially with import libraries.

Re: Different random shuffles generated when compiled with gdc than with dmd

2014-05-31 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2014-05-30 at 16:44 +, Andrew Brown via Digitalmars-d-learn wrote: GDC version 4.8.2,i guess that's my problem. This is what happens when you let Ubuntu look after your packages. Debian Sid has GCC 4.9 packages, but that may not help? -- Russel.

Re: Different random shuffles generated when compiled with gdc than with dmd

2014-05-31 Thread Dicebot via Digitalmars-d-learn
On Saturday, 31 May 2014 at 06:54:13 UTC, Russel Winder via Digitalmars-d-learn wrote: On Fri, 2014-05-30 at 16:44 +, Andrew Brown via Digitalmars-d-learn wrote: GDC version 4.8.2,i guess that's my problem. This is what happens when you let Ubuntu look after your packages. Debian Sid

Kernel in D

2014-05-31 Thread Mineko via Digitalmars-d-learn
So, I've gotten interested in kernel programming in D.. And as much as I like C/C++, I wanna try innovating, I'm aware that phobos/gc and any OS-specific issues are going to be a problem, but I'm willing to implement them into the kernel itself. So, I guess what I'm asking is this: What

Re: Building 32bit program with MSVC?

2014-05-31 Thread Jonathan M Davis via Digitalmars-d-learn
On Sat, 31 May 2014 06:38:46 + Kagamin via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: They may use different debugging formats, but just linking should be possible, especially with import libraries. _Dynamic_ linking is possible. Static linking is not. - Jonathan M Davis

Re: Hiding types

2014-05-31 Thread Philippe Sigaud via Digitalmars-d-learn
On Sat, May 31, 2014 at 6:39 AM, Dicebot via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: private in D does not provide any strong guarantees, it only controls direct access to the symbol. You effectively want some sort of strict internal linkage attribute which does not exist

Re: Building 32bit program with MSVC?

2014-05-31 Thread Kagamin via Digitalmars-d-learn
By dynamic linking do you mean LoadLibrary or linking with import library?

Re: Hiding types

2014-05-31 Thread Philippe Sigaud via Digitalmars-d-learn
What do you mean? Like this? Hidden* foo() { return new Hidden();} Yes, this way you can control all aspects of the construction and use. You wouldn't need to make it private even, just don't lay out the struct in the normal import: struct Hidden; I think you would need to use a .di

Re: Kernel in D

2014-05-31 Thread Kagamin via Digitalmars-d-learn
http://www.xomb.org/ ?

Re: Kernel in D

2014-05-31 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 31 May 2014 at 07:28:32 UTC, Mineko wrote: Any ideas? :P Buy my book, chapter 11 talks about it a little to get you started :P http://www.packtpub.com/discover-advantages-of-programming-in-d-cookbook/book The summary of my approach there is: 1) Use a regular linux compiler

Re: Kernel in D

2014-05-31 Thread ed via Digitalmars-d-learn
On Saturday, 31 May 2014 at 07:28:32 UTC, Mineko wrote: So, I've gotten interested in kernel programming in D.. And as much as I like C/C++, I wanna try innovating, I'm aware that phobos/gc and any OS-specific issues are going to be a problem, but I'm willing to implement them into the kernel

Re: enums

2014-05-31 Thread Andrej Mitrovic via Digitalmars-d-learn
This has been asked so many times, is this info not on the website? We should have an article on the site explaining this in depth. OT: Sorry for top-quoting and over-quoting. On Friday, May 30, 2014, monarch_dodra via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Friday, 30

Forward reference to nested function not allowed?

2014-05-31 Thread DLearner via Digitalmars-d-learn
Hi, import std.stdio; void main() { writefln(Entered); sub1(); sub1(); sub1(); writefln(Returning); void sub1() { static int i2 = 6; i2 = i2 + 1; writefln(%s,i2); }; } does not compile, but import std.stdio; void main() { void sub1() {

Re: Forward reference to nested function not allowed?

2014-05-31 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 31 May 2014 at 16:18:35 UTC, DLearner wrote: Is this intended? Yes, nested functions access local variables and thus follow the same order of declaration rules as they do; you can't use a local variable before it is declared so same with a nested function.

Indicating incompatible modules

2014-05-31 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
Hello all, Is there a straightforward way to indicate that two modules should not be used together in the same program? Preferably one that does not require editing both of the modules? The application I have in mind is when one is making available an experimental module which is planned

dmd segfaults

2014-05-31 Thread matovitch via Digitalmars-d-learn
Hi ! Does anybody knows why dmd segfaults on this code ? Should I report this as a bug ? import std.stdio; enum LiftingGender { PREDICT, UPDATE, } struct Test(float[][] coeffs, int[] offsets, LiftingGender gender) { immutable float[][] coeffs = coeffs;

Re: dmd segfaults

2014-05-31 Thread bearophile via Digitalmars-d-learn
matovitch: Does anybody knows why dmd segfaults on this code ? Should I report this as a bug ? Please report this minimized case to Bugzilla: struct Foo(int[] arr) { const int[] arr = arr; } void main() { Foo!([0]) foo; } The error it gives before the crash: test.d(2,17):

Re: dmd segfaults

2014-05-31 Thread matovitch via Digitalmars-d-learn
On Saturday, 31 May 2014 at 17:01:23 UTC, bearophile wrote: matovitch: Does anybody knows why dmd segfaults on this code ? Should I report this as a bug ? Please report this minimized case to Bugzilla: struct Foo(int[] arr) { const int[] arr = arr; } void main() { Foo!([0]) foo; }

Re: dmd segfaults

2014-05-31 Thread matovitch via Digitalmars-d-learn
In fact it segfauls on any template parameter if it has the same name as the immutable member (at least it's coherent). Something as simple as : struct Foo(int i) { immutable int i = i; } void main() { Foo!5 foo; writeln(foo); } I am suprised that nobody tried this before. BTW I

Re: dmd segfaults

2014-05-31 Thread matovitch via Digitalmars-d-learn
I remembered my psswd don't take my last sentence into account (i will filed this).

Re: dmd segfaults

2014-05-31 Thread via Digitalmars-d-learn
On Saturday, 31 May 2014 at 17:22:41 UTC, matovitch wrote: In fact it segfauls on any template parameter if it has the same name as the immutable member (at least it's coherent). Something as simple as : struct Foo(int i) { immutable int i = i; } void main() { Foo!5 foo;

Re: dmd segfaults

2014-05-31 Thread matovitch via Digitalmars-d-learn
I updated the issue. Strangely if done in the main everything is fine : Error: undefined identifier i

Re: dmd segfaults

2014-05-31 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, May 31, 2014 at 04:50:11PM +, matovitch via Digitalmars-d-learn wrote: Hi ! Does anybody knows why dmd segfaults on this code ? Should I report this as a bug ? [...] Compiler segfaults should always be reported. No matter how wrong the code may be, it is never right for the

Re: Forward reference to nested function not allowed?

2014-05-31 Thread Philippe Sigaud via Digitalmars-d-learn
See: http://dlang.org/function.html#variadicnested The second example explains that nested functions can be accessed only if the name is in scope.

Re: Indicating incompatible modules

2014-05-31 Thread Dicebot via Digitalmars-d-learn
On Saturday, 31 May 2014 at 16:34:00 UTC, Joseph Rushton Wakeling via Digitalmars-d-learn wrote: Hello all, Is there a straightforward way to indicate that two modules should not be used together in the same program? Preferably one that does not require editing both of the modules? The

Re: enums

2014-05-31 Thread Miles Stoudenmire via Digitalmars-d-learn
In contrast to those two examples where immutable can be used at compile time, what are some other cases where it is necessary to use enum instead of immutable? On 31 May 2014 09:33, Andrej Mitrovic via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: This has been asked so many

Re: enums

2014-05-31 Thread bearophile via Digitalmars-d-learn
Miles Stoudenmire: In contrast to those two examples where immutable can be used at compile time, what are some other cases where it is necessary to use enum instead of immutable? By default use enum if you define a compile-time-known value, unless it's composed data like an array, etc.

Re: Different random shuffles generated when compiled with gdc than with dmd

2014-05-31 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On 30/05/14 22:45, monarch_dodra via Digitalmars-d-learn wrote: Didn't you make changes to how and when the global PRNG is popped and accessed in randomShuffle? I figured it *could* be an explanation. No, it was partialShuffle that I tweaked, and that shouldn't affect the results here. There

Casting Structs

2014-05-31 Thread Paul D Anderson via Digitalmars-d-learn
I'm working on the decimal number package for D. A decimal is a struct with precision, max exponent and rounding mode parameters: Decimal!(PRECISION, MAX_EXPO, ROUNDING). I was trying to overload the opCast operator for this struct and I found that it does not seem necessary. I can cast

Re: Different random shuffles generated when compiled with gdc than with dmd

2014-05-31 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On 31/05/14 22:37, Joseph Rushton Wakeling via Digitalmars-d-learn wrote: On 30/05/14 22:45, monarch_dodra via Digitalmars-d-learn wrote: Didn't you make changes to how and when the global PRNG is popped and accessed in randomShuffle? I figured it *could* be an explanation. I think it's more

Re: enums

2014-05-31 Thread Paul D Anderson via Digitalmars-d-learn
On Saturday, 31 May 2014 at 20:14:59 UTC, bearophile wrote: Miles Stoudenmire: In contrast to those two examples where immutable can be used at compile time, what are some other cases where it is necessary to use enum instead of immutable? By default use enum if you define a

Re: enums

2014-05-31 Thread Timon Gehr via Digitalmars-d-learn
On 05/31/2014 11:21 PM, Paul D Anderson wrote: On Saturday, 31 May 2014 at 20:14:59 UTC, bearophile wrote: Miles Stoudenmire: In contrast to those two examples where immutable can be used at compile time, what are some other cases where it is necessary to use enum instead of immutable? By

Re: Different random shuffles generated when compiled with gdc than with dmd

2014-05-31 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On 31/05/14 23:22, Joseph Rushton Wakeling via Digitalmars-d-learn wrote: It's due to the the updated uniform() provided in this pull request: https://github.com/D-Programming-Language/phobos/commit/fc48d56284f19bf171780554b63b4ae83808b894 You can see the effects in action by running e.g. the

Re: enums

2014-05-31 Thread monarch_dodra via Digitalmars-d-learn
On Saturday, 31 May 2014 at 21:21:59 UTC, Paul D Anderson wrote: 'enum' as a manifest constant keyword has been an unpopular decision from its introduction. Everybody agrees that it should be changed. Everybody but Walter I find enum makes sense.

Re: Casting Structs

2014-05-31 Thread Ali Çehreli via Digitalmars-d-learn
On 05/31/2014 02:11 PM, Paul D Anderson wrote: I'm working on the decimal number package for D. A decimal is a struct with precision, max exponent and rounding mode parameters: Decimal!(PRECISION, MAX_EXPO, ROUNDING). I was trying to overload the opCast operator for this struct and I found that

Re: Casting Structs

2014-05-31 Thread Timon Gehr via Digitalmars-d-learn
On 06/01/2014 12:25 AM, Ali Çehreli wrote: dec10 little = cast(dec10(bingo)); You meant cast(dec10)(bingo). assert(little == dec10(123.45)); Is this expected behavior? Paul That is surprising. I've discovered that if the template has members that depend on a template parameter than the

Re: enums

2014-05-31 Thread Chris Nicholson-Sauls via Digitalmars-d-learn
On Saturday, 31 May 2014 at 22:13:35 UTC, monarch_dodra wrote: On Saturday, 31 May 2014 at 21:21:59 UTC, Paul D Anderson wrote: 'enum' as a manifest constant keyword has been an unpopular decision from its introduction. Everybody agrees that it should be changed. Everybody but Walter I find

Re: enums

2014-05-31 Thread bearophile via Digitalmars-d-learn
Chris Nicholson-Sauls: Good... I was starting to fear I was the only one. In general you can't fix the names in a language because you always find someone that likes the ones present :) I think enum is a bad name for the purpose of defining manifest constants, but I don't think this will

Re: Building 32bit program with MSVC?

2014-05-31 Thread Jonathan M Davis via Digitalmars-d-learn
On Sat, 31 May 2014 07:53:40 + Kagamin via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: By dynamic linking do you mean LoadLibrary or linking with import library? Both will work, otherwise we couldn't use Microsoft's libraries - e.g. std.windows.registry uses advapi32.dll

Re: Kernel in D

2014-05-31 Thread Qox via Digitalmars-d-learn
You should definitly use templating and CTFE for your advantage. For example you could use the (compile time) component based design to design (heap) allocators after a at cmpile time known configuration. The possibilities of templating and compile time code gen are enormous. Instead of

Re: Kernel in D

2014-05-31 Thread Qox via Digitalmars-d-learn
On Saturday, 31 May 2014 at 07:57:18 UTC, Kagamin wrote: http://www.xomb.org/ ? seems to be outdated, but its another OS written in D.

Re: Casting Structs

2014-05-31 Thread Paul D Anderson via Digitalmars-d-learn
On Saturday, 31 May 2014 at 22:34:45 UTC, Timon Gehr wrote: On 06/01/2014 12:25 AM, Ali Çehreli wrote: dec10 little = cast(dec10(bingo)); You meant cast(dec10)(bingo). assert(little == dec10(123.45)); Is this expected behavior? Paul That is surprising. I've discovered that if the

Re: Building 32bit program with MSVC?

2014-05-31 Thread Daniel Murphy via Digitalmars-d-learn
Jonathan M Davis via Digitalmars-d-learn wrote in message news:mailman.1421.1401576730.2907.digitalmars-d-le...@puremagic.com... By dynamic linking do you mean LoadLibrary or linking with import library? Both will work, otherwise we couldn't use Microsoft's libraries - e.g.

Re: Kernel in D

2014-05-31 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 31 May 2014 at 22:54:48 UTC, Qox wrote: scope(exit) foo(); uses exception handling in the background. That just works with dmd even in the bare metal environmnet. Throwing an exception needs library support with dmd but you can copy/paste it from druntime - I did that in my

how to detect ctfe

2014-05-31 Thread Vlad Levenfeld via Digitalmars-d-learn
Is there any way that I can detect whether or not a function is being evaluated at compile time? Specifically I want to switch between to use/not to use memoize!func without having to figure out when its CTFE-able and calling it with different syntax.