-
Notifications
You must be signed in to change notification settings - Fork 240
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
fixed warnings and packet.hpp encoding #51
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#include "CPP_VERSION.hpp" | ||
#ifndef BRYNET_HAVE_LANG_CXX17 | ||
#include <cstdbool> | ||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
#include <cstdint> | ||
#include <cassert> | ||
#include <cstdbool> | ||
#include <brynet/base/Bool.hpp> | ||
#include <cstring> | ||
#include <string> | ||
|
||
|
@@ -359,9 +359,17 @@ namespace brynet { namespace base { | |
void read(T& value) | ||
{ | ||
static_assert(std::is_same<T, typename std::remove_pointer<T>::type>::value, | ||
"T must a nomal type"); | ||
"T must be a nomal type"); | ||
#ifdef BRYNET_HAVE_LANG_CXX17 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 高版本的时候不需要判断pod 了么 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not removed, it has been fixed. |
||
static_assert(std::is_trivially_copyable_v<T>, | ||
"T must be trivially copyable"); | ||
|
||
static_assert(std::is_standard_layout_v<T>, | ||
"T must have a standard layout"); | ||
#else | ||
static_assert(std::is_pod<T>::value, | ||
"T must a pod type"); | ||
#endif | ||
|
||
if ((mPos + sizeof(value)) > mMaxLen) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
#pragma once | ||
|
||
#include <cstdbool> | ||
#include <cstring> | ||
#include <cstdlib> | ||
#include <cassert> | ||
#include <cstdint> | ||
|
||
#include <brynet/base/Array.hpp> | ||
#include <brynet/base/Bool.hpp> | ||
|
||
namespace brynet { namespace base { | ||
|
||
|
@@ -16,8 +16,8 @@ namespace brynet { namespace base { | |
size_t element_size; | ||
|
||
size_t element_num; | ||
size_t front; /* ջ�� */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 请问为何注释去掉了呢。 |
||
size_t num; /* ջ��ЧԪ�ش�С */ | ||
size_t front; /* TODO: add comment */ | ||
size_t num; /* TODO: add comment */ | ||
}; | ||
|
||
static void stack_delete(struct stack_s* self) | ||
|
@@ -115,7 +115,7 @@ namespace brynet { namespace base { | |
return (self->num == self->element_num); | ||
} | ||
|
||
/* stack��stack_push���ڿռ䲻���ʱ���Զ�����(ͨ��stack_increase) */ | ||
/* TODO: fix comment */ | ||
static bool stack_push(struct stack_s* self, const void* data) | ||
{ | ||
if (stack_isfull(self)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请问是为了什么警告呢? 我看 https://en.cppreference.com/w/cpp/header/cstdbool, 反而C++17时,不需要cstdbool