www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.debugger - budding d programmer seeking guidance for an issue

reply Yash Bhambhu <basyambhu gmail.com> writes:

std.range.pustd.outputrange.put() misbehave s when defined for 
void[] misbehaves when OutputRange.put(void[] exists)

  I started checking one by one for which case matches for input 
ranges and output range in put function and concluded that it 
matches the last if-else statement which is


  else static if (isInputRange!E && is(typeof(put(r, e.front))))


and it then pops front till range is empty which is its expected 
behavior but when we call put(r,e) it spits out random jargon 
which cant be in any possible case that comes under the power of 
put function.
I'm seeking further help and guidance on the same.
Dec 28 2019
next sibling parent Era Scarecrow <rtcvb32 yahoo.com> writes:
On Saturday, 28 December 2019 at 20:05:46 UTC, Yash Bhambhu wrote:

 std.range.pustd.outputrange.put() misbehave s when defined for 
 void[] misbehaves when OutputRange.put(void[] exists)
In the case where void[] is passed, could it cast to ubyte[]? Probably not the answer you're looking for...
Dec 28 2019
prev sibling parent Era Scarecrow <rtcvb32 yahoo.com> writes:
On Saturday, 28 December 2019 at 20:05:46 UTC, Yash Bhambhu wrote:
 but when we call put(r,e) it spits out random jargon which cant 
 be in any possible case that comes under the power of put 
 function.
Thinking about it a little further, void would mean it doesn't actually do anything with the array handed to it. So when you try to do _anything_ with void, it is pretty much ignored, meaning you're just getting the results that just happened to be in EAX (or whatever register it would have been working with) at the time.
Dec 28 2019