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

Make AllocationHeader::padding size_t #22

Open
legends2k opened this issue Dec 24, 2020 · 0 comments
Open

Make AllocationHeader::padding size_t #22

legends2k opened this issue Dec 24, 2020 · 0 comments

Comments

@legends2k
Copy link

legends2k commented Dec 24, 2020

Compilation Error

When compiling with Clang on Xcode, I get the following error

../src/StackAllocator.cpp:39:39: error: non-constant-expression cannot be narrowed from type 'std::size_t' (aka 'unsigned long') to 'char' in initializer list [-Wc++11-narrowing]
    AllocationHeader allocationHeader{padding};
                                      ^~~~~~~
../src/StackAllocator.cpp:39:39: note: insert an explicit cast to silence this issue
    AllocationHeader allocationHeader{padding};
                                      ^~~~~~~
                                      static_cast<char>( )

Compiler Details

Apple clang version 12.0.0 (clang-1200.0.32.28)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

In case padding can go beyond 255, it makes sense to make AllocationHeader::padding a size_t instead of a char as suggested by @talhasaruhan in #8.

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

No branches or pull requests

1 participant