Skip to content
This repository was archived by the owner on Jun 16, 2025. It is now read-only.

Several #define NV_ numeric types are suspect #1293

Open
@krader1961

Description

@krader1961

The symbols NV_INT32, NV_INT64 and NV_UINT16 are used to set the flags of a struct Namval but are not used to test if those attributes are set. That is highly suspicious. NV_INT32 is just an alias for NV_INTEGER and the other two set that bit and one other bit. Which suggests that it's only the setting of the NV_INTEGER bit that matters. But it is also possible that the places which test whether the value is one of those int types is also testing, as one example, that NV_INTEGER and NV_LONG being set using two distinct tests rather than testing if NV_INT64 is set. The two approaches are equivalent but highly misleading and will break if NV_INT64 ever becomes a distinct bit in the value type bit-mask.

Similarly there is exactly one use of NV_FLOAT:

if (tp->prefix) {
outname = (*tp->prefix == 't' &&
(!nv_isnull(np) ||
nv_isattr(np, NV_FLOAT | NV_RDONLY | NV_BINARY | NV_RJUST | NV_NOPRINT)));

This is also highly suspect and implies the correct test at that point is whether NV_DOUBLE is present.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions