GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Replace uint16_t with size_t for rule/blueprint routing to eliminate narrowing warnings by boulabiar · Pull Request #1118 · CrowCpp/Crow

Conversation

@boulabiar

@boulabiar boulabiar commented Nov 20, 2025

Copy link
Copy Markdown

• routing: use size_t for rule/blueprint indices; remove narrowing;

  • Replace uint16_t-based indices with size_t to avoid narrowing warnings.
  • include/crow/common.h
    • routing_handle_result
      • rule_index → size_t (was uint16_t)
      • blueprint_indices → std::vector<size_t> (was std::vector<uint16_t>)
      • Constructors updated to take size_t and std::vector<size_t>
  • include/crow/routing.h
    • Constants
      • INVALID_BP_ID → constexpr size_t INVALID_BP_ID{SIZE_MAX} (was uint16_t)
      • RULE_SPECIAL_REDIRECT_SLASH → constexpr size_t = 1 (was const int)
    • Trie::Node
      • rule_index → size_t (was uint16_t)
      • blueprint_index → size_t (was uint16_t)
    • Trie::find
      • Signature: pos → size_t; blueprints → std::vector<size_t>*
      • Locals: MT → std::vector<size_t>, found → size_t, found_BP → std::vector<size_t>
    • Trie::add
      • Signature: rule_index → size_t; blueprint_index → size_t
    • Router wiring
      • internal_add_rule_object overload BP_index → const size_t&
      • get_found_bp signature → std::vector<size_t>, index → size_t
      • bpi locals → std::vector<size_t>
      • Default routing_handle_result construction uses std::vector<size_t>()
      • rule_index locals → size_t

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Mohamed Ikbel Boulabiar
Replace uint16_t with size_t for rule/blueprint indices across routin…
81e0464
…g (routing_handle_result and Trie/Router) to eliminate narrowing warnings
This was referenced Nov 20, 2025
Alternative to uint16 t cast #1117
Merged
Explicitly cast 'size_t' to 'uint16_t' to avoid data loss warnings #1114
Closed
@boulabiar

boulabiar commented Nov 20, 2025

Copy link
Copy Markdown
Author

A stress test creating thousands of routes may be useful to see whether this reduced performance due to cache misses from the use of a bigger strcuture (size_t == 2x uint16_t)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gittiver

gittiver commented Nov 21, 2025

Copy link
Copy Markdown
Member

Well, that is done on startup normally, so it should have no influence when all rules are setup and requests are handled.
But, well, testing is always a good idea.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gittiver gittiver closed this Nov 21, 2025
@gittiver gittiver reopened this Nov 21, 2025
gittiver
gittiver approved these changes Dec 7, 2025
View reviewed changes
@gittiver
gittiver merged commit 1aa3fbb into CrowCpp:master Dec 7, 2025
@gittiver gittiver linked an issue Dec 7, 2025 that may be closed by this pull request
Explicitly cast 'size_t' to 'uint16_t' to avoid data loss warnings #1110
Closed
@gittiver gittiver mentioned this pull request Dec 7, 2025
Explicitly cast 'size_t' to 'uint16_t' to avoid data loss warnings #1110
Closed
@boulabiar
boulabiar deleted the sizet_fullCast branch December 7, 2025 17:09
@BrewTestBot BrewTestBot mentioned this pull request Feb 12, 2026
crow: add livecheck Homebrew/homebrew-core#267086
Merged
@BrewTestBot BrewTestBot mentioned this pull request Feb 19, 2026
crow 1.3.1 Homebrew/homebrew-core#268347
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gittiver gittiver gittiver approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Explicitly cast 'size_t' to 'uint16_t' to avoid data loss warnings

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@boulabiar @gittiver
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.