Skip to content

question about (uint64_t) strtoll #2159

Description

@eriksjolund

When reading the source code file src/libcrun/cgroup-systemd.c I noticed the use of (uint64_t) strtoll

$  git grep "(uint64_t) strtoll " remotes/origin/main
remotes/origin/main:src/libcrun/cgroup-systemd.c:        *value = (uint64_t) strtoll (resources->unified->values[i], &endptr, 10);
remotes/origin/main:src/libcrun/cgroup-systemd.c:  *value = (uint64_t) strtoll (str, &endptr, 10);

*value = (uint64_t) strtoll (resources->unified->values[i], &endptr, 10);

*value = (uint64_t) strtoll (str, &endptr, 10);

I'm a bit lost here. There is also another function strtoull() that could be used without needing to cast.

Why is not strtoull() used instead?

I see that strtoull() is used in a few places already

$ git grep strtoull remotes/origin/main | wc -l
       4

I'll plan to also ask an AI, to see if I can figure this mystery out by myself. If so, I'll close this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions