Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problematic string handle #33959

Closed
gengjiawen opened this issue Jun 19, 2020 · 3 comments
Closed

Problematic string handle #33959

gengjiawen opened this issue Jun 19, 2020 · 3 comments
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. quic Issues and PRs related to the QUIC implementation / HTTP/3.

Comments

@gengjiawen
Copy link
Member

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

@gengjiawen gengjiawen added c++ Issues and PRs that require attention from people who are familiar with C++. quic Issues and PRs related to the QUIC implementation / HTTP/3. labels Jun 19, 2020
@addaleax
Copy link
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.

@jasnell
Copy link
Member

jasnell commented Jun 19, 2020

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

@gengjiawen
Copy link
Member Author

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
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. quic Issues and PRs related to the QUIC implementation / HTTP/3.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants