-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
#include <cstddef>
, use std::size_t
(not just size_t
)
We use `std::size_t` (and not the global `size_t`) because it is the only variant that `<cstddef>` is guaranteed to provide, see <https://developers.redhat.com/blog/2016/02/29/why-cstdlib-is-more-complicated-than-you-might-think>: > You must not assume that `<cxxx>` adds any names to the global > namespace, and you must not assume that `<xxx.h>` adds any names to > namespace `std`. So technically we could do it the other way around (`#include <stddef.h>` and use `size_t` everywhere), but the `<xxx.h>` headers are deprecated in C++ in favour of `<cxxx>`. Plus I think it's somewhat beneficial to use the `std::` prefix, because it reminds us that it's a type from the standard library, so it needs an `#include`.
- Loading branch information
1 parent
d641d91
commit 7795aef
Showing
1 changed file
with
17 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters