Project

General

Profile

Design #1800

Conversion from SmallPrime to UNSIGNED long?

Added by John Abbott about 1 month ago. Updated 12 days ago.

Status:
In Progress
Priority:
Normal
Assignee:
-
Category:
Tidying
Target version:
Start date:
25 Mar 2024
Due date:
% Done:

10%

Estimated time:
Spent time:

Description

Currently there is an "implicit" conversion from SmallPrime to signed long.
Should the conversion instead be to unsigned long?
SmallPrime can never produce a negative value. One or two places in the code may be a little neater if the conversion were to unsigned long.
This does mean relaxing the refusal to use unsigned values...

History

#1 Updated by John Abbott about 1 month ago

We have long tried to avoid unsigned values because they can cause inconvenient, silent, automatic conversions.
But then I realised that overflow for signed values is "undefined behaviour" (which we must avoid).
I am increasingly tempted to relax the "veto" on unsigned values...

Discuss. Decide.

#2 Updated by John Abbott 12 days ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

I am quite tempted just to try changing the automatic conversion, but this should probably also be done with some other changes perhaps related to redesign of MachineInt?

Also available in: Atom PDF