On Wednesday, 9 July 2014 at 19:54:47 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
[...]
The problem is that the function needs to return
int, but given two uints, their difference may be
greater than int.max, so simply subtracting them
will not work. So the best I can come up with is:
Should of course be:
int compare2(uint x, int y)
{
return (x int.max) ? 1 : (cast(int)x - y);
}
On Monday, 7 July 2014 at 23:47:26 UTC, Aerolite wrote:
So, if you would be so kind, give me a bullet list of the
aspects of D you believe to be good, awesome, bad, and/or ugly.
If you have the time, some code examples wouldn't go amiss
either! Try not to go in-depth to weird edge cases -
On Wed, Jul 09, 2014 at 07:51:24AM +0200, Philippe Sigaud via
Digitalmars-d-learn wrote:
On Tue, Jul 8, 2014 at 7:50 AM, H. S. Teoh via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote quite a wall of text
Wow, what to add to that? Maybe you scared other from participating
;-)
I
On Monday, 7 July 2014 at 23:47:26 UTC, Aerolite wrote:
Hey all,
I've not posted here in a while, but I've been keeping up to
speed with D's progress over the last couple of years and
remain consistently impressed with the language.
I'm part of a new computing society in the University of
On Wednesday, 9 July 2014 at 14:51:41 UTC, Meta wrote:
One of the uglier things in D is also a long-standing problem
with C and C++, in that comparison of signed and unsigned
values is allowed.
I would like that, if it would be implemented along this line:
/// Returns -1 if a b, 0 if they
Of course without the ! after opCmp in the several cases.
On Wed, Jul 09, 2014 at 04:24:38PM +, Dominikus Dittes Scherkl via
Digitalmars-d-learn wrote:
On Wednesday, 9 July 2014 at 14:51:41 UTC, Meta wrote:
One of the uglier things in D is also a long-standing problem with C
and C++, in that comparison of signed and unsigned values is allowed.
On Wednesday, 9 July 2014 at 17:13:21 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
On Wed, Jul 09, 2014 at 04:24:38PM +, Dominikus Dittes
Scherkl via Digitalmars-d-learn wrote:
/// Returns -1 if a b, 0 if they are equal or 1 if a b.
/// this will always yield a correct result, no matter
On Wednesday, 9 July 2014 at 17:13:21 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
For the comparison s u, where s is a signed value and u is an
unsigned
value, whenever s is negative, the return value of opCmp must be
negative. Assuming 2's-complement representation of integers,
this
On Wednesday, 9 July 2014 at 17:13:21 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
The branched version would look something like this:
mov eax, [address of u]
mov ebx, [address of s]
cmp ebx, $#0
jge label1 ; first branch
mov
On Wed, Jul 09, 2014 at 05:43:15PM +, Dominikus Dittes Scherkl via
Digitalmars-d-learn wrote:
On Wednesday, 9 July 2014 at 17:13:21 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
[..]
Yeah, I don't see what's the problem with comparing signed and unsigned
values, as long as the result is
On Wed, Jul 09, 2014 at 11:29:06AM -0700, H. S. Teoh via Digitalmars-d-learn
wrote:
On Wed, Jul 09, 2014 at 05:43:15PM +, Dominikus Dittes Scherkl via
Digitalmars-d-learn wrote:
On Wednesday, 9 July 2014 at 17:13:21 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
[...]
Often, such
On Tue, Jul 8, 2014 at 7:50 AM, H. S. Teoh via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote quite a wall of text
Wow, what to add to that? Maybe you scared other from participating ;-)
* I'll second metaprogramming: the alliance between templates, CTFE
and mixins is really nice.
Hey all,
I've not posted here in a while, but I've been keeping up to
speed with D's progress over the last couple of years and remain
consistently impressed with the language.
I'm part of a new computing society in the University of
Newcastle, Australia, and am essentially known throughout
On Mon, Jul 07, 2014 at 11:47:25PM +, Aerolite via Digitalmars-d-learn
wrote:
[...]
So, if you would be so kind, give me a bullet list of the aspects of D
you believe to be good, awesome, bad, and/or ugly. If you have the
time, some code examples wouldn't go amiss either! Try not to go
16 matches
Mail list logo