Skip to content

Conversation

@mandel-macaque
Copy link
Contributor

Some of the fixes done for the warnings have breaking changes. Move back
to int and ensure that we do not have any compilation errors (we are
using -Werror).

Fixes: #7509

Some of the fixes done for the warnings have breaking changes. Move back
to int and ensure that we do not have any compilation errors (we are
using -Werror).

Fixes: dotnet#7509
@mandel-macaque mandel-macaque changed the title [Runtime] Move some of the changes back to int. (#7529) [d16-5][Runtime] Move some of the changes back to int. (#7529) Dec 16, 2019
monotouch_set_monodevelop_port (int port)
{
monodevelop_port = port;
monodevelop_port = (long) port;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that we are trying to remove long/unsigned long types because their size changes depending on the platform and somehow that is a breaking change?

It doesn't seem like there is any harm in casting an int to a long, but why are we doing this here when everywhere else we are removing the long type?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove long/unsigned long types

Not quite. They ([u]int/[u]long) are all fine individually... until you mix them up.

  • long -> int can overflow;
  • sign/unsigned changes can be issues too, e.g. -1 to unsigned;

The goal is not to remove anything specific but to be consistent (correctness) in their usage.

It doesn't seem like there is any harm in casting an int to a long

Right, it is generally not an issue... unless mapped to memory, e.g. change a structure member from int to long can (alignment dependent) change its size or element position, which might be defined elsewhere (e.g. mono or in managed code).

An earlier PR enabled the compiler to spot those changes (i.e. emit warnings) and also turn warnings into errors.

However there were issues in the previous fixes (the compiler does not see everything, having no warning/error does not mean the code works). @rolfbjarne listed them inside #7509

@monojenkins
Copy link
Collaborator

Build failure
Build succeeded
API Diff (from stable)
API Diff (from PR only) (no change)
Generator Diff (no change)
🔥 Test run failed 🔥

Test results

1 tests failed, 87 tests passed.

Failed tests

  • monotouch-test/watchOS 32-bits - simulator/Debug: Crashed

@mandel-macaque
Copy link
Contributor Author

@mandel-macaque mandel-macaque merged commit c44e339 into dotnet:d16-5 Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants