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

fix for error: ‘size_t’ does not name a type #6721

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

smash-cracker
Copy link

@smash-cracker smash-cracker commented Feb 14, 2025

FIX(client): Build error with make -j$(nproc) note: ‘size_t’ is defined in header ‘’;

Copy link
Member

@Krzmbrzl Krzmbrzl left a comment

Choose a reason for hiding this comment

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

Please adapt your commit to follow our commit guidelines and don't introduce any formatting changes unrelated to your commit.

@davidebeatrici
Copy link
Member

don't introduce any formatting changes unrelated to your commit.

It's not his fault, any recent clang-format version formats the file like this (which is correct):

-	AudioPreprocessor(const AudioPreprocessor &) = delete;
+	AudioPreprocessor(const AudioPreprocessor &)            = delete;
 	AudioPreprocessor &operator=(const AudioPreprocessor &) = delete;

In #6511 I simply edited the line manually in order for CI to pass.

@@ -6,6 +6,7 @@
#ifndef MUMBLE_MUMBLE_AUDIOPREPROCESSOR_H_
#define MUMBLE_MUMBLE_AUDIOPREPROCESSOR_H_

#include <cstddef>
Copy link
Member

Choose a reason for hiding this comment

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

Alternatively, we could specify the namespace when using the datatype: std::size_t

It's actually recommended for C++ code.

Copy link
Member

Choose a reason for hiding this comment

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

I think you still need to include that header though, no? I think it is the one defining both versions.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah. I think so. So can i do anything to help?

Copy link
Member

Choose a reason for hiding this comment

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

<cstddef> is only required to guarantee the datatype appears in the global namespace.

See https://stackoverflow.com/a/5079408.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think that is correct. According to https://en.cppreference.com/w/cpp/types/size_t you need to include a header in order to have std::size_t and one of the headers that defines it is cstddef.

In fact, according to https://stackoverflow.com/a/36594716 cstddef is required to define the namespaced version and only optionally may define the version in global namespace.

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