I tried translate C++ programm to D, but result is different.
original:
https://github.com/urraka/alpha-bleeding/blob/master/src/alpha-bleeding.cpp
result (with removed alpha):
https://github.com/urraka/alpha-bleeding/blob/master/media/alpha-bleeding-opaque.png
my:
https://pastebin.com/GzZQ7WHt
On Monday, 27 November 2017 at 14:08:27 UTC, Dmitry wrote:
I tried translate C++ programm to D, but result is different.
original:
https://github.com/urraka/alpha-bleeding/blob/master/src/alpha-bleeding.cpp
result (with removed alpha):
Did you confirm that the image was loaded originally correctly?
On Monday, 27 November 2017 at 14:14:12 UTC, rikki cattermole
wrote:
Did you confirm that the image was loaded originally correctly?
Yes.
This image was used:
https://github.com/urraka/alpha-bleeding/blob/master/media/original.png
On 11/25/17 5:13 PM, Adam D. Ruppe wrote:
On Saturday, 25 November 2017 at 16:16:52 UTC, A Guy With a Question wrote:
If D chooses it's defaults to make errors stick out, why not just
error at declaration if they don't explicitly set it to something.
It technically did:
On Monday, 27 November 2017 at 14:58:42 UTC, Steven Schveighoffer
wrote:
I rely on the default value initialization all the time! I
don't know how that would jive with structs, since they are
technically local variables, but usually are valid without
initialization.
Yes, indeed, me too. I
On Monday, 27 November 2017 at 17:01:29 UTC, Adam D. Ruppe wrote:
In the C++ version they are declared
std::vector pending;
std::vector pendingNext;
Ah, indeed. I thought that
pending.reserve(N);
pendingNext.reserve(N);
initializes them (last time I used C++ about 17 years ago...)
I
On Monday, 27 November 2017 at 14:08:27 UTC, Dmitry wrote:
https://pastebin.com/GzZQ7WHt
The first thing that jumped out to me is this:
size_t[] pending = new size_t[N];
size_t[] pendingNext = new size_t[N];
That's giving it N elements of zero, then you append to it later
with
On Saturday, 25 November 2017 at 09:39:15 UTC, Dave Jones wrote:
I mean at the end of the day, that would turn a run time error
into a compile time error which is a good thing isnt it?
Debatable in this case. Consider:
string servicePhoneNumber;
final switch (car.manufacturer) //an
On Monday, 27 November 2017 at 14:35:39 UTC, Stefan Koch wrote:
First I'd make sure that what you get out of dlib load is the
same as the c++ version gets.
Just use standard debugging techniques.
Yes, it's same. As you can see, the top-middle area of the result
is same.
I wrote a video of
On Monday, 27 November 2017 at 16:04:14 UTC, Dukc wrote:
Debatable in this case. Consider:
string servicePhoneNumber;
final switch (car.manufacturer) //an enumerated value.
Well, the compiler can see it is initialized before being read
again later, so that *should* pass the check (at least
On Friday, 10 November 2017 at 11:55:57 UTC, Guillaume Piolat
wrote:
For now we do have some @nogc alternatives for mutex, condition
variables, thread-pool, file reading, etc... (dplug:core
package) for use with the runtime disabled - the middle ground
that's way more usable than -betterC.
On Monday, 27 November 2017 at 18:40:41 UTC, Ali Çehreli wrote:
So, it looks like the original code was accessing out of bounds
and probably that's why you inserted the ((index + 3) < N)
check in the D version because D was catching that error at
runtime.
Yes, it is.
Which of course would
On Mon, Nov 27, 2017 at 07:10:04PM +, A Guy With a Question via
Digitalmars-d-learn wrote:
> Hi again!
>
> I've been trying to do my best to write idiomatically. One thing that
> is bugging me is having to mark up all of my declarations with
> attributes. Which means I'm having to remember
On Monday, 27 November 2017 at 17:21:05 UTC, Dmitry wrote:
It fixed a delay (you can see it on video I posted before), but
result is same.
It seems I found the problem.
C++ version (line 93):
if (image[index + 3] != 0)
I changed to
if (image[index] != 0)
and it works.
I don't understand
On 11/27/2017 10:25 AM, Dmitry wrote:
> On Monday, 27 November 2017 at 17:21:05 UTC, Dmitry wrote:
>> It fixed a delay (you can see it on video I posted before), but result
>> is same.
>
> It seems I found the problem.
>
> C++ version (line 93):
> if (image[index + 3] != 0)
>
> I changed to
> if
On 11/27/2017 10:47 AM, Dmitry wrote:
> On Monday, 27 November 2017 at 18:40:41 UTC, Ali Çehreli wrote:
>
>> So, it looks like the original code was accessing out of bounds and
>> probably that's why you inserted the ((index + 3) < N) check in the D
>> version because D was catching that error at
Hi again!
I've been trying to do my best to write idiomatically. One thing
that is bugging me is having to mark up all of my declarations
with attributes. Which means I'm having to remember them all.
It's a bit much to keep in my head with every function. Is there
a good way to reverse this
On 11/27/17 2:10 PM, A Guy With a Question wrote:
Hi again!
I've been trying to do my best to write idiomatically. One thing that is
bugging me is having to mark up all of my declarations with attributes.
Which means I'm having to remember them all. It's a bit much to keep in
my head with
On Monday, 27 November 2017 at 19:10:04 UTC, A Guy With a
One thing that is bugging me is having to mark up all of my
declarations with attributes.
Meh, you could also just ignore the attribute crap. Only reason I
ever mess with them is if someone who is using them tries to use
my code...
On Monday, 27 November 2017 at 19:41:03 UTC, Adam D. Ruppe wrote:
On Monday, 27 November 2017 at 19:10:04 UTC, A Guy With a
One thing that is bugging me is having to mark up all of my
declarations with attributes.
Meh, you could also just ignore the attribute crap. Only reason
I ever mess
On Tuesday, 28 November 2017 at 05:10:39 UTC, bauss wrote:
null != void
"initialized or not?" != void
On Monday, 27 November 2017 at 19:01:28 UTC, Ali Çehreli wrote:
P.S. I think you have an unnecessary 'ref' on the D version
because a slice is already a reference to elements:
Fixed, thank you.
On Tuesday, 28 November 2017 at 05:10:39 UTC, bauss wrote:
null != void
also...void is a completely useless concept for initialisation.
what can you determine about the nothingness of void? ... nothing.
writeln(typeof(void).stringof); // ?? what do I know now? nothing.
vs
Nullable!int x;
On Monday, 27 November 2017 at 02:12:40 UTC, codephantom wrote:
On Saturday, 25 November 2017 at 15:34:21 UTC, John Chapman
wrote:
Is there any way of determining whether a variable has been
initialized or not? For example, if something is declared like
this:
int x = void;
can I check if
On Saturday, 25 November 2017 at 22:13:43 UTC, Adam D. Ruppe
wrote:
It technically did:
https://dlang.org/spec/function.html#local-variables
"It is an error to use a local variable without first assigning
it a value. The implementation may not always be able to detect
these cases. Other
On Monday, 27 November 2017 at 20:07:08 UTC, A Guy With a
Question wrote:
On Monday, 27 November 2017 at 19:41:03 UTC, Adam D. Ruppe
wrote:
On Monday, 27 November 2017 at 19:10:04 UTC, A Guy With a
One thing that is bugging me is having to mark up all of my
declarations with attributes.
Meh,
27 matches
Mail list logo