0

As already discussed here integral promotion rules can cause headaches in some cases (especially for arithmetic operations between signed and unsigned types). At the end of this answer there is a link to a proposal. However that proposal is from 2012 and I don't know if it was even submitted.

Are there any active proposals or plans to change integral promotion rules to something like the next higher ranked signed type that can hold the value range of the promoted type? I know this causes inconsistency as unsigned long long cannot be promoted to any higher ranked type. This isn't a perfect solution but wouldn't it be at least better than the current situation?

Timo
  • 9,269
  • 2
  • 28
  • 58
  • 1
    I'm kinda tempted to say this can be a dupe https://stackoverflow.com/questions/52175977/how-to-track-newer-c-std-documents-of-given-topic – StoryTeller - Unslander Monica Nov 28 '18 at 14:41
  • 3
    I personally would prefer that all the implicit conversions were deprecated and then removed from the language, however something like this is definitely not going to happen. – user7860670 Nov 28 '18 at 14:42
  • 1
    Per [this](https://cplusplus.github.io/EWG/ewg-status.html) the issue is still open – NathanOliver Nov 28 '18 at 14:48
  • @VTT How would this play along with minimum type must be `int` for arithmetic operatrions? – Timo Nov 28 '18 at 14:49
  • I think this is an atavism inherited directly from B (or even from BCPL) that had only a single "cell" type. I don't see any reason not to make arithmetic operations yield the same type as operands and not to have routines to handle overflow. – user7860670 Nov 28 '18 at 15:02
  • 2
    Note that the proposal that the answer links to is only about overload resolution. It wouldn't change any promotion rules. – Pete Becker Nov 28 '18 at 15:13
  • @VTT note the [rationale for promotion rules as they are can be found in the C99 rationale](https://stackoverflow.com/a/24372323/1708801) – Shafik Yaghmour Nov 28 '18 at 16:55

0 Answers0