Skip to content

Commit

Permalink
78 (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
wanghenshui authored Sep 2, 2022
1 parent 67f934a commit d25cee6
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 47 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RSS使用仓库的release RSS [链接](https://github.com/wanghenshui/cppweeklyn
| --------------------- | --------------------- | --------------------- | --------------------- | --------------------- | --------------------- | --------------------- | --------------------- | --------------------- | --------------------- |
| [五十一](./posts/051.md) | [五十二](./posts/052.md) | [五十三](./posts/053.md) | [五十四](./posts/054.md) | [五十五](./posts/055.md) | [五十六](./posts/056.md) | [五十七](./posts/057.md) | [五十八](./posts/058.md) | [五十九](./posts/059.md) | [六十期](./posts/060.md) |
| [六十一](./posts/061.md) | [六十二](./posts/062.md) | [六十三](./posts/063.md) | [六十四](./posts/064.md) | [六十五](./posts/065.md) | [六十六](./posts/066.md) | [六十七](./posts/067.md) | [六十八](./posts/068.md) | [六十九](./posts/069.md) | [七十期](./posts/070.md) |
| [七十一](./posts/071.md) |[七十二](./posts/072.md)|[七十三](./posts/073.md)|[七十四](./posts/074.md)|[七十五](./posts/075.md)|[七十六](./posts/076.md)|[七十六](./posts/076.md)|[七十七](./posts/077.md)|||
| [七十一](./posts/071.md) |[七十二](./posts/072.md)|[七十三](./posts/073.md)|[七十四](./posts/074.md)|[七十五](./posts/075.md)|[七十六](./posts/076.md)|[七十七](./posts/077.md)|[七十八](./posts/078.md)|||


---
107 changes: 86 additions & 21 deletions posts/078.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,80 +2,145 @@
layout: post
title: 第78期
---

# C++ 中文周刊 第78期

`TODO add README then remove this line`


[reddit](https://www.reddit.com/r/cpp/)/[hackernews](https://news.ycombinator.com/)/[lobsters](https://lobste.rs/)/[meetingcpp](https://www.meetingcpp.com/blog/blogroll/)摘抄一些c++动态
[reddit](https://www.reddit.com/r/cpp/)/[hackernews](https://news.ycombinator.com/)/[lobsters](https://lobste.rs/)/[meetingcpp](https://www.meetingcpp.com/blog/blogroll/items/Meeting-Cpp-weekly-Blogroll-344.html)摘抄一些c++动态

`TODO fix meetingcpp blogroll link`

[周刊项目地址](https://github.com/wanghenshui/cppweeklynews)[在线地址](https://wanghenshui.github.io/cppweeklynews/)[知乎专栏](https://www.zhihu.com/column/jieyaren) |[腾讯云+社区](https://cloud.tencent.com/developer/column/92884)

弄了个qq频道,[手机qq点击进入](https://qun.qq.com/qqweb/qunpro/share?_wv=3&_wwv=128&inviteCode=xzjHQ&from=246610&biz=ka)

欢迎投稿,推荐或自荐文章/软件/资源等

`TODO update draft name`

可以贴在下一期草稿里 [草稿链接](https://github.com/wanghenshui/cppweeklynews/blob/dev/posts/78.md)

可以贴在下一期草稿里 [草稿链接](https://github.com/wanghenshui/cppweeklynews/pull/9)

`TODO update date here`
2020 09 02

---

## 资讯

标准委员会动态/ide/编译器信息放在这里

[编译器信息最新动态推荐关注hellogcc公众号 本周更新 2022-01-05 第131期](https://github.com/hellogcc/osdt-weekly/blob/master/weekly-2022/2022-01-05.md)
[编译器信息最新动态推荐关注hellogcc公众号 本周更新 2022-08-31 第165期](https://github.com/hellogcc/osdt-weekly/blob/master/weekly-2022/2022-08-31.md)

`TODO fix link then remove this line`

## 文章

- [c++ tip of week ](https://github.com/QuantlabFinancial/cpp_tip_of_the_week/)
- [What is the “vector pessimization”?](https://quuxplusone.github.io/blog/2022/08/26/vector-pessimization/)

`TODO fix link then remove this line`
尽量让move 构造函数 noexcept, 不然用vector可能有问题,多copy

比如这个
```cpp
struct Instrument {
int n_;
std::string s_;

Instrument(const Instrument&) = default;

// WRONG!!
Instrument(Instrument&& rhs)
: n_(std::exchange(rhs.n_, 0)),
s_(std::move(s_))
{}

// RIGHT!!
Instrument(Instrument&& rhs) noexcept
: n_(std::exchange(rhs.n_, 0)),
s_(std::move(s_))
{}
};
```
如果不是noexcept,vector的move判定内部的T不是is_nothrow_move_constructible, 那就构造复制一份,所以多了个拷贝。也就是博主说的vector pessimization问题
vector本身的搬迁move的多余动作,如果能nothrow,move就更简单
- [malloc() and free() are a bad API](https://www.foonathan.net/2022/08/malloc-interface/#content)
free没有size看上去是个巧妙的设计,实际上隐含了挺多脏活
- [C++ Coroutines: Understanding the Compiler Transform](https://lewissbaker.github.io/2022/08/27/understanding-the-compiler-transform)
协程背后都做了啥
## 视频
- [Did you know that C++17 `[[nodiscard]]` attribute can be applied not only to function?](https://github.com/QuantlabFinancial/cpp_tip_of_the_week/blob/master/293.md)
- [C++ Weekly ](https://www.youtube.com/channel/UCxHAlbZQNFU2LgEtiqd2Maw)
有点意思
`TODO fix link then remove this line`
```cpp
struct foo {
[[nodiscard]] foo(auto& resource) {}
};
struct [[nodiscard]] bar {};
auto fn() -> bar;
[[nodiscard]] auto fn2() -> bool;
int main(int, char** argv){
foo{argv}; // ignoring temp created by [[nodiscard]]
fn(); // ignoring return value with [[nodiscard]]
fn2(); // ignoring return value with [[nodiscard]]
}
```
- [Do we need the Y-combinator in C++? ](http://ib-krajewski.blogspot.com/2017/10/do-we-need-y-combinator-in-c-and.html?m=1)

老文,科普一下概念。

- [constexpr Function Parameters](https://www.elbeno.com/blog/?p=1685)

参数不是constexpr
```cpp
consteval auto square(int x) -> int { return x * x; }

constexpr auto twice_square(int x) -> int { return square(x); }
```
## 开源项目需要人手
编译不过。作者展示了一下编译期计算。哎又回去了。constexpr还是不够const
- [asteria](https://github.com/lhmouse/asteria) 一个脚本语言,可嵌入,长期找人,希望胖友们帮帮忙,也可以加群384042845和作者对线
- [pika](https://github.com/OpenAtomFoundation/pika) 一个nosql 存储, redis over rocksdb,非常需要人贡献代码胖友们, 感兴趣的欢迎加群294254078前来对线
- [实现一个trivially_copyable的tuple ](http://www.purecpp.cn/detail?id=2309)
- [并发与异步执行流中的对象角色概述(一) ](http://www.purecpp.cn/detail?id=2310)
- [编程语言-从来如此的便是对吗?](https://zhuanlan.zhihu.com/p/558778083)
看个乐
- [-march=, -mcpu=, and -mtune=](https://zhuanlan.zhihu.com/p/559008342)
介绍这几个flag
`-march=native`肯定接触过吧
## 新项目介绍/版本更新
- [20+ Ways to Init a String, Looking for Sanity](https://www.cppstories.com/2022/init-string-options/)
茴香豆的茴的20种写法
- [Why am I getting a null pointer crash when trying to call a method on my C++/WinRT object?](https://devblogs.microsoft.com/oldnewthing/20220901-00/?p=107097)
为什么大哥解bug这么熟练
## 视频
- [C++ Weekly - Ep 339 - `static constexpr` vs `inline constexpr`](https://www.youtube.com/watch?v=QVHwOOrSh3w)
static constexpr 和 inline constexpr区别。inline constexpr能合并文件重复的数据,是文件级别,static是函数级别,并不能合并代码段
聪明的你想到了static inline constexpr。这个效果就是static constexpr。static限制了范围
## 开源项目需要人手
- [asteria](https://github.com/lhmouse/asteria) 一个脚本语言,可嵌入,长期找人,希望胖友们帮帮忙,也可以加群384042845和作者对线
- [pika](https://github.com/OpenAtomFoundation/pika) 一个nosql 存储, redis over rocksdb,非常需要人贡献代码胖友们, 感兴趣的欢迎加群294254078前来对线
## 工作招聘
寒冬了
---
看到这里或许你有建议或者疑问或者指出错误,请留言评论! 多谢! 你的评论非常重要!也可以帮忙点赞收藏转发!多谢支持!
Expand Down
27 changes: 2 additions & 25 deletions posts/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
layout: post
title: 第NNN期
---

# C++ 中文周刊 第NNN期

`TODO add README then remove this line`


[reddit](https://www.reddit.com/r/cpp/)/[hackernews](https://news.ycombinator.com/)/[lobsters](https://lobste.rs/)/[meetingcpp](https://www.meetingcpp.com/blog/blogroll/)摘抄一些c++动态
[reddit](https://www.reddit.com/r/cpp/)/[hackernews](https://news.ycombinator.com/)/[lobsters](https://lobste.rs/)/[meetingcpp](https://www.meetingcpp.com/blog/blogroll/)/[purecpp](http://www.purecpp.cn/)知乎等等摘抄一些c++动态

`TODO fix meetingcpp blogroll link`

Expand All @@ -20,8 +18,7 @@ title: 第NNN期

`TODO update draft name`

可以贴在下一期草稿里 [草稿链接](https://github.com/wanghenshui/cppweeklynews/blob/dev/posts/NNN.md)

可以贴在下一期草稿里 [草稿链接](https://github.com/wanghenshui/cppweeklynews/pull/NNN.md)

`TODO update date here`

Expand All @@ -41,39 +38,19 @@ title: 第NNN期

`TODO fix link then remove this line`











## 视频

- [C++ Weekly ](https://www.youtube.com/channel/UCxHAlbZQNFU2LgEtiqd2Maw)

`TODO fix link then remove this line`









## 开源项目需要人手

- [asteria](https://github.com/lhmouse/asteria) 一个脚本语言,可嵌入,长期找人,希望胖友们帮帮忙,也可以加群384042845和作者对线
- [pika](https://github.com/OpenAtomFoundation/pika) 一个nosql 存储, redis over rocksdb,非常需要人贡献代码胖友们, 感兴趣的欢迎加群294254078前来对线

## 新项目介绍/版本更新



## 工作招聘

---
Expand Down

0 comments on commit d25cee6

Please sign in to comment.