113 subscribers
34 photos
35 links
How to code?
@Lazymio
Download Telegram
数据千万条,事务第一条
并发不注意,回滚两行泪
Forwarded from Lazymio
python2只是没有区分bytes和string
Forwarded from Lazymio
犯了C++的错误
libpcap 捕获的包长度可能大于 MTU 吗?
其实是有可能的,关键在于网卡的 Offload,简单来说操作系统为了更好的 IO 性能,可能几个包一起交付给网卡然后硬件分片/分段,然而 libpcap 工作在操作系统和网卡之间所以虽然最后发出去的包小于 MTU 但是 libpcap 看到的是大于 MTU 的啦。
struct base1
{
virtual ~base1() { }
int value1;
};

struct base2
{
virtual ~base2() { }
int value2;
};

struct derived : public base1, public base2
{
};

int main()
{
derived obj;
base1* p1 = &obj;
base2* p2 = &obj;
assert(static_cast<void*>(p1) == static_cast<void*>(p2));
}

C++ is amazing!
好吧,其实就是多继承问题。
How2Code
struct base1 { virtual ~base1() { } int value1; }; struct base2 { virtual ~base2() { } int value2; }; struct derived : public base1, public base2 { }; int main() { derived obj; base1* p1 = &obj; base2* p2 = &obj; assert(static_cast<void*>(p1)…
struct base1
{
virtual ~base1() { }
int value1;
};

struct base2
{
virtual ~base2() { }
int value2;
};

struct derived : public base1, public base2
{
};

int main()
{
derived obj;
base1* p1 = &obj;
base2* p2 = &obj;
assert(dynamic_cast<void*>(p1) == dynamic_cast<void*>(p2));
}

More amazing.
原因是 dynamic_cast 返回的地址是最派生类的起始地址,也就是 &obj.
没用的小知识: 怎么让宏必须以分号结尾🤔
没用的小知识: 怎样快速Abort😏
Authors can include data for inline client-side scripts or server-side site-wide scripts to process using the data-*="" attributes. These are guaranteed to never be touched by browsers, and allow scripts to include data on HTML elements that scripts can then look for and process.

From <https://html.spec.whatwg.org/multipage/introduction.html#introduction>
amazing!
Forwarded from Lazymio
连W3C都给周杰伦背书啦(溜
菱形继承
How2Code
菱形继承
所以说我真的讨厌 iostream 的设计
这是给人用的.jpg?