<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Programming on pg999w&#39;s blog</title>
    <link>https://vpssg1.zyk999.top/tags/programming/</link>
    <description>Recent content in Programming on pg999w&#39;s blog</description>
    <generator>Hugo</generator>
    <language>zh-cn</language>
    <lastBuildDate>Mon, 30 Dec 2024 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://vpssg1.zyk999.top/tags/programming/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>可执行文件与动态库共享全局变量</title>
      <link>https://vpssg1.zyk999.top/post/rust-dylib-export/</link>
      <pubDate>Mon, 16 Sep 2024 00:00:00 +0000</pubDate>
      <guid>https://vpssg1.zyk999.top/post/rust-dylib-export/</guid>
      <description>&lt;p&gt;有时候我们会希望通过 dlopen 来加载一个动态链接库，并且在主程序中和库中访问同一个全局变量。下面用 Rust 来实现一个 &lt;a href=&#34;https://en.wikipedia.org/wiki/Minimal_reproducible_example&#34;&gt;MWE&lt;/a&gt;。&lt;/p&gt;</description>
    </item>
    <item>
      <title>Rust 和 C&#43;&#43; 的对象生命管理</title>
      <link>https://vpssg1.zyk999.top/post/rust-cpp-object-management/</link>
      <pubDate>Tue, 14 Nov 2023 00:00:00 +0000</pubDate>
      <guid>https://vpssg1.zyk999.top/post/rust-cpp-object-management/</guid>
      <description>&lt;p&gt;Rust 和 C++ 的对象都是值语义，都采用了 RAII 惯用法。所以他们需要处理类似的对象生命周期问题：需要专门的代码来处理对象的初始化，复制和析构。下面进行一个比较，我们能够看到两种语言之间内在的对称性。&lt;/p&gt;</description>
    </item>
    <item>
      <title>为 Typst 添加中文排版支持</title>
      <link>https://vpssg1.zyk999.top/post/typst-clreq/</link>
      <pubDate>Sat, 22 Jul 2023 00:00:00 +0000</pubDate>
      <guid>https://vpssg1.zyk999.top/post/typst-clreq/</guid>
      <description>&lt;p&gt;Typst 是一个 2023 年初开源的一个排版软件。类似于 LaTeX，它通过纯文本编写源代码，然后通过编译器将源代码转换为排版好的 PDF 文件。虽然目前 Typst 的生态还不如 LaTeX，但是比起 LaTeX，它有一些明显的优势：&lt;/p&gt;</description>
    </item>
    <item>
      <title>Too many channels in Rust but only one in Go</title>
      <link>https://vpssg1.zyk999.top/post/too-many-channels/</link>
      <pubDate>Thu, 24 Mar 2022 00:00:00 +0000</pubDate>
      <guid>https://vpssg1.zyk999.top/post/too-many-channels/</guid>
      <description>&lt;p&gt;Channel 是异步编程 CSP 模型&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;和 Actor 模型的重要组成部分，是一种用于消息同步的数据结构。Go 语言中的 &lt;code&gt;chan&lt;/code&gt; 类型即是一种 channel 的实现。在使用 Rust 进行异步编程的时候也需要使用 channel。然而 Rust 中的 channel 似乎太多了。&lt;/p&gt;</description>
    </item>
    <item>
      <title>用 Julia 编写 CUDA 程序</title>
      <link>https://vpssg1.zyk999.top/post/julia-cuda/</link>
      <pubDate>Sat, 22 Jan 2022 00:00:00 +0000</pubDate>
      <guid>https://vpssg1.zyk999.top/post/julia-cuda/</guid>
      <description>&lt;p&gt;CUDA 本身是一个 C 库，而 CUDA kernel 则需要使用扩展的 C/C++ 语法。但 &lt;a href=&#34;https://cuda.juliagpu.org/stable/&#34;&gt;CUDA.jl&lt;/a&gt; 让 Julia CUDA 编程成为可能。然而虽然 CUDA.jl 实现了绝大多数 CUDA 的功能，但其文档仍很不完善。本文补充了一些常见 CUDA 功能在 Julia 中的写法。本文假设读者预先具有 Julia，CUDA，以及 CUDA.jl 的基本知识。&lt;/p&gt;</description>
    </item>
    <item>
      <title>用 Perl 做查找替换</title>
      <link>https://vpssg1.zyk999.top/post/perl-replace/</link>
      <pubDate>Sat, 01 Jan 2022 00:00:00 +0000</pubDate>
      <guid>https://vpssg1.zyk999.top/post/perl-replace/</guid>
      <description>&lt;p&gt;现在需要把一篇文章中两个中文字符中的回车给删掉。这时候需要用到支持 Unicode 的正则表达式。这时候我们还是用最强大的字符处理语言 Perl 来搞。命令如下：&lt;/p&gt;</description>
    </item>
    <item>
      <title>Rust 编译到 musl target 的踩坑记录</title>
      <link>https://vpssg1.zyk999.top/post/rust-musl-target/</link>
      <pubDate>Sun, 30 May 2021 00:00:00 +0000</pubDate>
      <guid>https://vpssg1.zyk999.top/post/rust-musl-target/</guid>
      <description>&lt;p&gt;Rust 在 x86_64-unknown-linux-gnu 目标下默认会动态链接到系统 C 运行时&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;，而不同发行版之间的 libc 可能会有兼容性问题。如果想要把一次编译好的可执行文件放到不同的 Linux 发行版上面去跑，最好采用 x86_64-unknown-linux-musl 目标进行静态编译。&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; 每三年才解决一点点问题</title>
      <link>https://vpssg1.zyk999.top/post/c&#43;&#43;-template-constraint/</link>
      <pubDate>Mon, 30 Nov 2020 00:00:00 +0000</pubDate>
      <guid>https://vpssg1.zyk999.top/post/c&#43;&#43;-template-constraint/</guid>
      <description>&lt;p&gt;或：怎样优雅地给 C++ 模板添加约束？&lt;/p&gt;</description>
    </item>
    <item>
      <title>Docker 搭建 RoboMaster RoboRTS 框架构建环境</title>
      <link>https://vpssg1.zyk999.top/post/ros-docker/</link>
      <pubDate>Sun, 02 Aug 2020 00:00:00 +0000</pubDate>
      <guid>https://vpssg1.zyk999.top/post/ros-docker/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://github.com/RoboMaster/RoboRTS&#34;&gt;RoboRTS&lt;/a&gt; 框架用于大疆的 RoboMaster ICRA 人工智能挑战赛。其构建环境基于 &lt;a href=&#34;https://www.ros.org/&#34;&gt;ROS&lt;/a&gt;，在非 Ubuntu/CentOS 的 Linux 机器上面安装较为困难。于是我们采用基于 docker 的构建方案。&lt;/p&gt;</description>
    </item>
    <item>
      <title>用 Perl 进制转换</title>
      <link>https://vpssg1.zyk999.top/post/perl-hex/</link>
      <pubDate>Mon, 22 Jun 2020 00:00:00 +0000</pubDate>
      <guid>https://vpssg1.zyk999.top/post/perl-hex/</guid>
      <description>&lt;p&gt;现在需要把一堆十进制数转换为二进制数，在 Vim 里可以用 &lt;code&gt;:&#39;&amp;lt;,&#39;&amp;gt;!command&lt;/code&gt; 来做转换。但是我发现常见的行处理程序 &lt;code&gt;awk&lt;/code&gt; 根本搞不定进制转换，所以还是用最强大的字符处理语言 Perl 来搞。命令如下：&lt;/p&gt;</description>
    </item>
    <item>
      <title>从 C&#43;&#43; 的错误处理说起</title>
      <link>https://vpssg1.zyk999.top/post/c&#43;&#43;-p0709/</link>
      <pubDate>Thu, 16 Apr 2020 00:00:00 +0000</pubDate>
      <guid>https://vpssg1.zyk999.top/post/c&#43;&#43;-p0709/</guid>
      <description>&lt;p&gt;&lt;strong&gt;错误处理&lt;/strong&gt;是一个非常重要的软件工程问题。对软件中出现的非致命错误的不当处理，是几乎所有的灾难性系统故障的诱因。&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt; 编程语言往往需要提供一些用于错误处理的语言设施，这些设施反过来会影响项目中错误处理的方式。不同的语言错误处理方式不同。例如 Java 采用基于 try-throw-catch 语法的异常机制，而 Go 语言则选择手动检测函数返回的 &lt;code&gt;error&lt;/code&gt; 对象。一个令人惊讶的事实是，C++ 到现在还没有一个被广泛接受的错误处理方式。&lt;/p&gt;</description>
    </item>
    <item>
      <title>constexpr string</title>
      <link>https://vpssg1.zyk999.top/post/constexpr-string/</link>
      <pubDate>Thu, 19 Dec 2019 00:00:00 +0000</pubDate>
      <guid>https://vpssg1.zyk999.top/post/constexpr-string/</guid>
      <description>&lt;p&gt;按照 &lt;a href=&#34;https://akrzemi1.wordpress.com/2017/06/28/compile-time-string-concatenation/&#34;&gt;Andrzej&amp;rsquo;s C++ blog&lt;/a&gt; 里这篇文章的思路，我实现了一个编译期的字符串拼接：&lt;/p&gt;</description>
    </item>
    <item>
      <title>Rust 的指针别名优化</title>
      <link>https://vpssg1.zyk999.top/post/csarpp-opt/</link>
      <pubDate>Sat, 19 Jan 2019 00:00:00 +0000</pubDate>
      <guid>https://vpssg1.zyk999.top/post/csarpp-opt/</guid>
      <description>&lt;p&gt;本文研究了基于 Rust 具有的所有权语义的一些优化。&lt;/p&gt;</description>
    </item>
    <item>
      <title>为什么编程语言总是应该使用UTF-8而不是UTF-16</title>
      <link>https://vpssg1.zyk999.top/post/why-utf16-sacks/</link>
      <pubDate>Sat, 15 Dec 2018 00:00:00 +0000</pubDate>
      <guid>https://vpssg1.zyk999.top/post/why-utf16-sacks/</guid>
      <description>&lt;p&gt;&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;前段时间研究字符编码的时候，看到了一个&lt;a href=&#34;https://www.zhihu.com/question/35214880&#34;&gt;知乎问题&lt;/a&gt;，里面的回答基本上都概念不清，事实上，Unicode “字符”、&#xA;“字符串”、“编码”等词语涉及到非常复杂的概念。而目前介绍这个主题的中文文章似乎较为稀少，于是有了这篇文章。&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
