-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
PROBLEM
- We want to use the types that provide the best fit for the valid range of our components property.
- Say we have a property that represents a quantity that is always > 0, we want it to be declared as an unsigned integer
- We declare a member
m_propof type sayuint32_t - This property must then declared in the XPCF configuration file as
uint.
Our problem is that after some code reviews, we noticed that sometimes signed integer types have been used.
We want to be able to change the type to unsigned integer in the code, but we want to ensure that all occurence of these property declarations in XPCF configuration files also set the type to uint, otherwise unexpected behavior can happen if a confiuration file set the value to a negative integer value.
This is tedious work, and we could expect XPCF to striclty enforce type compatiblity automatically for us.
But from what I tested:
- No error is raised if a property is declared as
uint32_tin code and asintin configuration file - No error is raised if a property is declared as
uintin the configuration file and a negative value is set to it.
SUGGESTED SOLUTION
Would it be technically feasible to:
- Ensure
declarePropertybinds equivalent types (signed with signed, unsigned with unsigned) and raises an error if types do not match? - Raise an error if a negative value is set to a property declared as
uintin a configuration file?
Thanks.
Metadata
Metadata
Assignees
Labels
No labels