Skip to content

Conversation

@andresy
Copy link
Member

@andresy andresy commented Oct 31, 2025

Proposed changes

  • array class prefers int64_t instead of size_t
  • SmallVector is inherently small -- sizes are now int
  • propagate the signedness through the codebase and fix warnings accordingly

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the necessary documentation (if needed)

const Allocator& allocator = Allocator())
: allocator_(allocator) {
if (init.size() > capacity()) {
if (static_cast<int>(init.size()) > capacity()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it use std:ssize to match the style of other code?

// Get the value out of it:
auto s = x.item<float>();
assert(s == 1.0);
(void)s;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C++17 has a [[maybe_unused]] for this purpose.
https://en.cppreference.com/w/cpp/language/attributes/maybe_unused.html


private:
// Grows the backing store by a factor of two, and at least to {min_capacity}.
// TODO: Move to private after removing external code using this method.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this PR but since it is adjacent to your changes can you help delete this line? It is a finished TODO that I forgot to remove.

VERSION ${MLX_PROJECT_VERSION})

if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
add_compile_options(-Wall -Wextra)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be moved to the # ---- Lib ---- section below.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants