V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  junkman  ›  全部回复第 1 页 / 共 2 页
回复总数  22
1  2  
@raysonx 支持,原本我也想叛逃 CentOS 的,这么说的话我得重新考虑下我之前的决定了。

另外请教下几个问题:

1. 如果直接在 CentOS Stream 上修复 bug 的话,那么那些宣称兼容 RHEL 的 Linux 发行版获取 bug fixes 也是从 CentOS Stream 获取是这个意思吗?

2. CentOS 8 Stream 的 Life cycle 是多长?网上似乎没有找到 CentOS 8 EOL 之后 Stream 的支持时长。
2020-09-24 10:48:38 +08:00
回复了 codechaser 创建的主题 Android GDB Android ADB Shell 远程调试 C++程序问题
keywords: gdb wait for process
可以尝试用 waitfor,具体看 https://lldb.llvm.org/use/map.html
2020-09-24 10:42:56 +08:00
回复了 codechaser 创建的主题 Android GDB Android ADB Shell 远程调试 C++程序问题
2020-04-17 20:03:56 +08:00
回复了 raysonx 创建的主题 宽带症候群 为你的 IPv6 局域网配置 ULA 吧
> 无状态地址配置将不可用

具体是?请问这方面看哪里的资料比较好。

> 更别说还有其他缺点

比如?

感谢大侠解答!
2020-04-17 09:37:24 +08:00
回复了 raysonx 创建的主题 宽带症候群 为你的 IPv6 局域网配置 ULA 吧
diff:
- 似乎用 fd00::8 /120 子段就可以了呢?
+ 似乎用 fd00:: 前缀下的某个 /120 子段就可以了呢?
2020-04-17 09:35:40 +08:00
回复了 raysonx 创建的主题 宽带症候群 为你的 IPv6 局域网配置 ULA 吧
@raysonx 2020 年,再次翻出来提问。

家用的话,IPv6 /48 子段应该有 2^80 个可用 IP,但是家用的话应该撑死 256 个地址就够用了吧?

似乎用 fd00::8 /120 子段就可以了呢?
2020-04-05 19:29:52 +08:00
回复了 Buffer2Disk 创建的主题 Go 编程语言 golang 如何指定一个程序内部使用的全局 dns
https://golang.org/pkg/net/#Dialer

```golang
type Dialer struct {
...
// Resolver optionally specifies an alternate resolver to use.
Resolver *Resolver
...
}
```

可以在 Dialer 层设置 net.Resolver,然后再用 HTTP 包裹 Dialer,最后发起连接即可。
你可以封装下上面的 struct,这样所有网络请求都可以走自定义的 DNS 了。
2019-06-17 14:52:08 +08:00
回复了 wheeler 创建的主题 C 请教一个关于 C 语言注释的问题
@wheeler 从词法分析的角度来看,在一个 statement 开头添加 /* Block comment */是没有问题的,如果你能保证你的标注程序只标注在一个 statement 的开始,按照现有的 C syntax。

如果可能出现在一个 statement 的任意位置(比如中间位置),那么在出现多行连接的情况下,可能会产生诸如嵌套 /* Block comment */的问题,而大部分编译器是不支持嵌套 /* Block comment */的,因此这就导致无法编译通过。

不过上面的例子过于吹毛求疵了,如果你只是想问可行性的话,我觉得大部分情况都是可行的,现有编译器在提示错误的时候,基本上报错也出现在 statement 开始所在的行。
2019-06-15 09:47:52 +08:00
回复了 wheeler 创建的主题 C 请教一个关于 C 语言注释的问题
> C 的代码库,给定文件和行号,要求在给定的行添加注释来做标记,注释的内容只包含字母和数字。要求不能改坏代码。

这个情况,在行前行尾添加注释都是不行的,因为多行连接的问题(\)会导致破坏代码正确性。

为什么不换一种方式觉得这种问题呢?比如在一个单独的文件添加错误标注呢?

或者说,这种错误标记可以在内存中停留吗,然后给到相应的处理程序?为什么一定要修改(侵略)文件呢?
2019-06-14 18:52:26 +08:00
回复了 jamfer 创建的主题 程序员 实现了半财务自由,分享一下我的收入来源和一些想法
看得我抑郁了
2019-06-11 10:41:24 +08:00
回复了 samples 创建的主题 程序员 vivo nex 旗舰版 如何安装 google play?
建议把 nex 自带的 Google Play services 删除然后安装最新版的。
2019-06-11 10:39:56 +08:00
回复了 samples 创建的主题 程序员 vivo nex 旗舰版 如何安装 google play?
我也是 vivo,你可以去 www.apkmirror.com 下载 Google Play Store 和 Google Play services。

都安装就可以了。

APKMirror 来源是可靠的
see:
https://www.apkmirror.com/faq/#Security_What_measures_do_you_take_to_make_sure_all_uploadedAPKs_are_real_and_created_by_the_respective_developers
2019-06-11 10:33:28 +08:00
回复了 africwildman 创建的主题 C 用 c 分配内存,为什么普遍都是用 malloc 而不是用 calloc?
performance agin -> performance gain
2019-06-11 10:32:20 +08:00
回复了 africwildman 创建的主题 C 用 c 分配内存,为什么普遍都是用 malloc 而不是用 calloc?
@wheeler 赞同

实际上,calloc 的实现在多数操作系统的实现和 malloc 几乎一样快,比如 Linux/FreeBSD 内核可能会直接返回 pre zero-mapped pages。

> You're likely to still see a performance improvement without overcommit. The OS will try to zero free pages in the background, so there's a good chance that it'll have pre-zeroed pages to hand you when you ask for them, rather than making you wait for them to be zeroed on demand.
Of course, there are plenty of systems where this doesn't happen, or there are no pages in the first place, or there's no kernel zeroing stuff for you.

回到问题本身,我觉得这个可能是历史原因,早期 calloc 作为一个库函数用于消除平台之间内存分配的差异,当初实现初始化零也是直接按字节填零操作的,可能是出于防御性编程的考虑(当时可能还没有这种概念),方便 debug。可能和 @wheeler 所说的类似,零内存使用场景并不大,而且清零还费时(当时机器性能可不如现在这么强大),malloc 孕育而生。大部分情况下申请内存之后我们都会填入一些数据,这样来看,使用 malloc 可以获得 performance agin。

> So the (slightly modified) question still stands: Why do calloc and malloc exist? Indeed it looks like calloc was originally intended as a portable way to allocate memory. It used the function alloc which apparently was not meant to be used directly; most iolib functions have a 'c' tacked on. So when iolib was reworked into the stdlib why was calloc kept? saretired suspects backward compatibility but I don't believe this, because no other c-prefixed iolib function was kept and i couldn't find any code that actually used calloc in the v6 distribution either. So maybe whoever is responsible for malloc/calloc in v7 (I think it was ken, not dmr) thought malloc should be a public function but saw a use for calloc and changed the semantics to be a bit more predictable.

see:
https://news.ycombinator.com/item?id=13108434

如果什么地方说的不对,麻烦指正。:-P
2019-02-22 19:25:44 +08:00
回复了 liuxu 创建的主题 PHP 一个正则表达式写不出来
Only one addressee case failed :-(
2019-02-22 19:23:22 +08:00
回复了 liuxu 创建的主题 PHP 一个正则表达式写不出来
To:( =\?.*\?= )(Cc|Subject):

NOTE: Assume `Subject' always present

see: https://regex101.com/r/l7xxeN/2/
2019-02-19 19:15:52 +08:00
回复了 rizon 创建的主题 程序员 mac 系统的 finder 无法显示第三方软件的图标状态
按住 Option 的同时右键 Dock 里的 Finder,选择 Relaunch 试试看?

另外你的系统版本多少? 看看 sw_vers(1) 输出的结果?

另外看看 pluginkit -mv 给出什么输出?
2019-02-17 14:47:15 +08:00
回复了 sdijeenx 创建的主题 macOS macOS Mojave 内核出现 tx_flush()错误要怎么解决?
不支持那个数字 5 代表的什么,可能是 errno ?

<sys/errno.h>: #define EIO 5 /* Input/output error */

这个 tx_flush_thread 应该是 apfs 的一个函数。

是不是磁盘出现了什么问题?
2019-02-13 19:52:05 +08:00
回复了 nyse 创建的主题 C 关于 C 语言自增自减的问题?
If you using -Wall to compile above code, you would see multiple unsequenced modifications warning.

```
$ gcc -Wall foobar.c
foobar.c:6:29: warning: multiple unsequenced modifications to 'j' [-Wunsequenced]
printf("%d ,%d\n", ++i+j++, j--);
^ ~~
1 warning generated.
```

In short, as @momocraft aforementioned, parameter evaluation order is unspecified, it depends on compiler implementation, i.e. it can be LR-evaluated or RL-evaluated.

BTW, above code is extremely EVIL, as a guideline, [Don't be evil]( https://en.wikipedia.org/wiki/Don%27t_be_evil)

see: https://stackoverflow.com/questions/34266773/language-c-compile-time-error-multiple-unsequenced-modifications-werror-wun
2019-01-24 12:10:24 +08:00
回复了 greed1is9good 创建的主题 程序员 bing 搜索怎么了??
听说是 z.f.下令屏蔽的
1  2  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2886 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 30ms · UTC 13:47 · PVG 21:47 · LAX 06:47 · JFK 09:47
Developed with CodeLauncher
♥ Do have faith in what you're doing.