Skip to content

Problematic string handle #33959

Description

@gengjiawen

if (alpn == NGTCP2_ALPN_H3 + 1) {

clang warning:

../../src/quic/node_quic_crypto.cc:563:30: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
  if (alpn == NGTCP2_ALPN_H3 + 1) {
              ~~~~~~~~~~~~~~~^~~

image

cc @jasnell @nodejs/quic

Activity

  1. added
    c++Issues and PRs that require attention from people who are familiar with C++.
    quicIssues and PRs related to the QUIC transport implementation.
    on Jun 19, 2020
  2. addaleax commented on Jun 19, 2020

    @addaleax
    Member

    Right, I’ve run into this as well, but the problem is that the clang warning is just not helpful here. clang suggests using &NGTCP2_ALPN_H3[1] to me, which would probably fix the warning but also look quite a bit more confusing imo.

  3. jasnell commented on Jun 19, 2020

    @jasnell
    Member

    The &NGTCP2_ALPN_H3[1] syntax is more confusing but it'll work. Let's just go with that to avoid the compiler warning

  4. gengjiawen commented on Jun 19, 2020

    @gengjiawen
    MemberAuthor

    Okay, I finally got the original +1 😃 (string + int is pointer arithmetic in C)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++Issues and PRs that require attention from people who are familiar with C++.quicIssues and PRs related to the QUIC transport implementation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions