Compiling debug missing errors

2017-04-09 Thread Duarte via Digitalmars-d-learn
Hi all, Using the following example: --- import std.stdio; pure void foo() { debug { stdout.writeln("1"); } stdout.writeln("2"); } void main(string[] args) { foo(); } --- Using either '-debug' or '-release', the second stdout will give a

Re: Compiling debug missing errors

2017-04-09 Thread Duarte via Digitalmars-d-learn
On Sunday, 9 April 2017 at 20:59:26 UTC, ag0aep6g wrote: On 04/09/2017 10:49 PM, Duarte wrote: [...] You're allowed to break purity in debug code. From the spec: "As a concession to practicality, a pure function can also [...] perform impure operations in statements that are in a Conditiona

Dump mixins (preprocessed/generated) code

2014-07-18 Thread Domingo Alvarez Duarte via Digitalmars-d-learn
Hello ! I'm trying to make MiniD/Croc work with dmd2 and I'm having a problem with this code and I want to know how to dump the generated code to understand what's happening. How that can be done ? debugmixin.d-mixin-15(15): Error: no identifier for declarator char[] -debugmixin.d ///

Re: Dump mixins (preprocessed/generated) code

2014-07-18 Thread Domingo Alvarez Duarte via Digitalmars-d-learn
Thank you so much ! That did exactly what I was looking for, but now why I'm getting that error message ? Any help is welcome ! Cheers ! The generated code seems to fine: debug assert(t.stackIndex > t.stackBase, (printStack(t), printCallStack(t), "fail.")); static if(!is(typeof(__FUNCT

Re: Dump mixins (preprocessed/generated) code

2014-07-18 Thread Domingo Alvarez Duarte via Digitalmars-d-learn
Thanks for all you answers, I think I found the problem. The constant __FUNCTION__ was not a compiler reserved word at the time MiniD/Croc was created and it was introduced later on dmd2, it was clashing with it. I renamed it to __MFUNCTUION__ and it compiles now, I'm getting more errors of

Re: Dump mixins (preprocessed/generated) code

2014-07-18 Thread Domingo Alvarez Duarte via Digitalmars-d-learn
It seems to be a bug somewhere because tired of getting errors with dmd 2.065 I switched to dmd 2.066 trunk and the error vanished.

Re: std.zip and a large archive

2014-07-19 Thread Domingo Alvarez Duarte via Digitalmars-d-learn
It seems that ti only works for zip files with less than 65000 entries, zip64 that allow read more than that do seem to be implemented.

Re: std.zip and a large archive (spell fix)

2014-07-19 Thread Domingo Alvarez Duarte via Digitalmars-d-learn
It seems that this only works for zip files with less than 65000 entries, zip64 that allow read more than that do not seem to be implemented.

Manually allocated structs

2014-07-27 Thread Domingo Alvarez Duarte via Digitalmars-d-learn
Hello ! I have the code bellow that I want to manually allocate to use in runtime code, because I declared the payload "buf[1]" the compiler complains about index out of bounds then I managed to do this "*(&tmp.buf + tmp.used++) = c;" instead of "tmp.buf[tmp.used++] = c;" as is done usually i

Re: Manually allocated structs

2014-07-27 Thread Domingo Alvarez Duarte via Digitalmars-d-learn
On Sunday, 27 July 2014 at 12:49:01 UTC, Adam D. Ruppe wrote: I would do it something like this: struct test { size_t size; @property char[] buf() { return (_buf.ptr)[0 .. size]; } private char[0] _buf; } The buf property returns a slice that us

Re: Manually allocated structs

2014-07-27 Thread Domingo Alvarez Duarte via Digitalmars-d-learn
Hello again ! Anyone knows how to compile with gdc for different versions I could not find how gdc implements it if it does ? The proposed usage of "@property char[] buf()" although seems to work when compiled with dmd, segfaults when compiled with gdc: Code to test import std.stdio; i

Bug on dmd or gdc ?

2014-07-27 Thread Domingo Alvarez Duarte via Digitalmars-d-learn
Hello ! Based on a question about manually allocated structures with payload I found that a solution proposed seems to work when compiled with dmd but segfaults when compiled with gdc. So my question is: Is this a bug on dmd, gdc or a bad idiom ? code to see the problem import std.stdio

Re: Bug on dmd or gdc ?

2014-07-28 Thread Domingo Alvarez Duarte via Digitalmars-d-learn
On Monday, 28 July 2014 at 08:16:37 UTC, bearophile wrote: Domingo Alvarez Duarte: Based on a question about manually allocated structures with payload I found that a solution proposed seems to work when compiled with dmd but segfaults when compiled with gdc. ... int size;

What is this ? Howw to solve it ?

2014-10-14 Thread Domingo Alvarez Duarte via Digitalmars-d-learn
With dmd trunk trying to compile vibed after fixing several array declarations from C style to D style I'm getting this error that I do not understand: --- Building vibe-d 0.7.21-rc.2 configuration "libevent", build type debug. Running dmd... /home/mingo/dev/d/src/install/bin/../../../