std.algorithm Map using a external variable
Zardoz
luis.panadero at gmail.com
Mon Dec 10 13:46:31 PST 2012
Well. I just try it again and I noticed this things :
-Changind the lambda function from :
auto caca2 = map!((a) {return a * iDeltaT;})(caca);
to :
auto caca2 = map!((a) {return a + iDeltaT;})(caca);
Avoid the segmentation fault
-Using dmd 2.60 avoid the segmentation fault.
The source code is in
http://dl.dropbox.com/u/2716434/CodeThatCrash.tgz
The makefile only builds againts gdc, so to test it with dmd, I
manually compiled the faulty code of serie2Sim.d with :
dmd serie2Sim.d entity.d vector.d -ofserie2Sim
And I launch it with ./serie2Sim --rand 10 --seed 123
With dmd works, but with gdc not.
On Monday, 10 December 2012 at 18:59:31 UTC, H. S. Teoh wrote:
> On Mon, Dec 10, 2012 at 07:21:47PM +0100, Zardoz wrote:
>> I'm trying to use Map with a code like this :
>>
>> ...
>> immutable int m = 10;
>> int[] caca = [1,2,3,4];
>>
>> auto caca2 = map!( (a) {return a * m;})(caca);
>>
>> writeln(caca2);
>> ...
>>
>> I get a Segmentation fault some times:
>> The most interesting point it's that depends of the code
>> around of
>> it ins the same program. for example If a use getopt at the
>> begin
>> of my program, then seg fault, etc...
> [...]
>
> Do you have a compilable sample (possibly reduced from your full
> sources) that exhibits this error? It would help track down the
> problem.
>
> There are some known bugs related to map in older releases of D
> that may
> be affecting you.
>
>
> T
More information about the Digitalmars-d-learn
mailing list