- 主题:编了个关于C++的段子
不要告诉我们你能做什么,告诉我们你是怎么做的。
比如cond_var,能不能用更加浅显的语言来说,省得我们又要买书。
比如STL的源码,VC6臭名昭著,sgi的我觉得也看得费劲,能不能讲的更详细点。
--
FROM 106.120.233.*
不懂 cond_var 不是 c++ 的问题吧,pthread 或者 windows api 里也都是一样的概念
【 在 billybear04 的大作中提到: 】
: 不要告诉我们你能做什么,告诉我们你是怎么做的。
: 比如cond_var,能不能用更加浅显的语言来说,省得我们又要买书。
: 比如STL的源码,VC6臭名昭著,sgi的我觉得也看得费劲,能不能讲的更详细点。
: ...................
--
FROM 114.249.199.*
【 在 milksea (肥了,又肥了 >>>_<<<) 的大作中提到: 】
: 不懂 cond_var 不是 c++ 的问题吧,pthread 或者 windows api 里也都是一样的概念
你来了,太好了。
https://stackoverflow.com/questions/53286110/what-does-a-single-total-order-mean-in-stdnotify-one
The effects of notify_one()/notify_all() and each of the three atomic parts of wait()/wait_for()/wait_until() (unlock+wait, wakeup, and lock) take place in a single total order that can be viewed as modification order of an atomic variable: the order is specific to this individual condition_variable. This makes it impossible for notify_one() to, for example, be delayed and unblock a thread that started waiting just after the call to notify_one() was made.
What does it mean by saying "take place in a single total order"? How is this related to the next sentence "This makes it impossible ..... was made."? (It seems that it's telling a cause and effect).
I read it word by word more than 10 times and don't understand what it's saying.. Definition of "total order" from Wikipedia can't help much.
"偏序关系、全序关系都是公理集合论中的一种二元关系"。
我写了条知乎,但不知道对乎。total order是全序关系吗?pthread和Windows API,我还能看懂。再如vector的iterator,我是先知道的它,后看的设计模式。好像有本书叫做《用C++做设计》,北大翻译的那本书里也讲了些设计。我的意思是:有没有本书,讲std的设计和实现,例如cond_var调用了pthread吗?里面有几把锁,为什么…… 不用全讲,讲重点,数学少提一点,但可以给个链接,给有兴趣的人看,再如提句GOF的书里讲了iterator,没那么大兴趣的人,看完书后学到了(些)好的设计理念。不要搞成不先把离散数学和OS学好,就没法学C++了呀。20要上barrier了呀。
--
修改:billybear04 FROM 106.120.233.*
FROM 106.120.233.*
很多用stl的人不愿去理解strict weak order。
--
FROM 73.63.211.*
"A strict weak ordering is a binary relation < on a set S that is a strict partial order (a transitive relation that is irreflexive, or equivalently, that is asymmetric) in which the relation "neither a < b nor b < a" is transitive. "
https://stackoverflow.com/questions/979759/operator-and-strict-weak-ordering
我记得人话版是[有错请纠正]: 一个STL的容器,放的是自定义的数据类型,例如struct Person {...}; 只需要定义<运算符。STL内部是如何判断等于的?if(!(a<b) && !(b<a))则说明a等于b。好得很,这给编译器的优化留下了巨大的生存空间啊。再定义operator==太过了。
>=就是!<,<=呢?我不知道。< || ==,< || (!< && !<)?
请问single total order是啥意思?
===
我记得这些都是书:《C++程序设计语言》、《Linux系统编程》、《Unix开发环境》、《Windows网络编程》、《Windows多媒体编程》……
不能啥都往std里放啊。C++ 22再放点图像、音视频处理的算法?那C++课只能本科最后一年再上,研究生还得开《高级C++编程》
我觉得:C++语言本身、常用容器、strcmp,atoi之类,就差不多了。
===
咱也文化下:-):没有数据结构的编程语言是无用的。STL容器是数据结构的合理延伸。算法+数据结构=程序(这句抄的),它们之间有着正交性(不是making love),换而言之,某个算法可以应用于多种容器。i.e. A particular algorithm can be employed to fuck containers of various kinds. The relationship can be consummated in many programming languages.
Oh, my algorithm is having regular coitus with a hashset.
What's he talking, Amy?
记错了。The Big Bang Theory, 4-5:
Sheldon: I assure you I am quite real and I'm having regular intercourse with your daughter.
Mrs. Fowler: What?
Sheldon: Oh, yes. We're like wild animals in heat. It's a wonder neither of us has been hurt.
Mrs. Fowler: Amy, what is he saying?
talk可以及物,talking rubbish,但似乎不及物更多:What are you talking about? 语言啊语言
--
修改:billybear04 FROM 106.121.70.*
FROM 106.121.161.*