commonmark / commonmark/cmark

[Clang-tidy] Narrowing data types is implementation defined

Open
#437 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
2k
Forks
691
Avg merge
1d 16h
Merged PRs (30d)
1

Description

Clang-Tidy: Narrowing conversion from 'unsigned char' to signed type 'char' is implementation-defined

const unsigned char *eol;
S_is_line_end_char(*eol)

where S_is_line_end_char is defined as:

static CMARK_INLINE bool S_is_line_end_char(char c) {
  return (c == '\n' || c == '\r');
}

I'm sending a PR to fix it as well.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from the shown call to S_is_line_end_char and its definition, then inspect how the unsigned char value is passed to the char parameter. Done means the implementation-defined narrowing warning is resolved without changing line-ending behavior; run the project's existing checks afterward.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.