Bug or what?
Phil Lavoie via Digitalmars-d
digitalmars-d at puremagic.com
Wed Aug 27 13:30:08 PDT 2014
On Wednesday, 27 August 2014 at 20:28:11 UTC, Phil Lavoie wrote:
> On Wednesday, 27 August 2014 at 20:05:27 UTC, MacAsm wrote:
>> On Wednesday, 27 August 2014 at 19:51:48 UTC, Phil Lavoie
>> wrote:
>>> Ok so me and one of my colleagues have been working on some
>>> code at a distance. We both use dmd as the compiler. I am
>>> under Windows, she OSX.
>>>
>>> It is not uncommon that she experiences more strictness in
>>> the type system than I do. For example, something like this
>>> does compile for me, but not for her:
>>>
>>> int func(size_t i)
>>> {
>>> return i;
>>> }
>>>
>>> It passes my compilation. She gets an error msg about
>>> implicit casting of uint to int. I'm just wondering... has
>>> anybody else experienced that and what is the expected
>>> behavior?
>>>
>>> Thanks,
>>> Phil
>>
>> size_t is a typedef to unsigned (check out
>> http://dlang.org/type.html). So this warning is correct. I
>> don't get this warning too. Maybe it's the type-checking that
>> does differ on OSX. Are you using same compiler version and
>> flags?
>
> Yeah yeah I checked it out and we both use same versions and
> everything. Basically, to bit word size coherent I should just
> have writtent this instead:
>
> ptrdiff_t func(size_t i) {return i;}
>
> Though it is still somewhat unsafe, at least it behaves the
> same on both our machines.
>
> Phil
Note that the compiler behaves the same, the code, not
necessarily.
More information about the Digitalmars-d
mailing list