<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"><channel><title>MagicLen</title><link>https://magiclen.org/tag/cc/feed</link><description>多元化原創文章，內容包羅萬象，有程式語言、網站應用、軟體介紹、硬體介紹、作業系統、旅行遊記、專題採訪、益智問題、文學創作，以及作者們的知識分享和作品分享。</description><language>zh-TW</language><lastBuildDate>Tue, 21 Apr 2026 10:38:49 +0000</lastBuildDate><sy:updatePeriod>hourly</sy:updatePeriod><sy:updateFrequency>8</sy:updateFrequency><sy:updateBase>1970-01-01T00:00+00:00</sy:updateBase><item><title>如何使用Rust程式語言產生隨機數值？</title><link>https://magiclen.org/random-number</link><description><![CDATA[    <img src="https://magiclen.org/wp-content/uploads/2018/04/rust-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2018/04/rust-220x162.png 1x, https://magiclen.org/wp-content/uploads/2018/04/rust-440x324.png 2x, https://magiclen.org/wp-content/uploads/2018/04/rust-660x486.png 3x" alt="">
在開發程式的時候常常會需要產生亂數，然而，電腦並不存在「真正隨機」的亂數，它只能夠透過一些機制，利用額外的參考數值(如時間等)來模擬出看起來是隨機的亂數。]]></description><category>研究分享</category><category>Rust</category><category>C/C++</category><category>Rust</category><category>random-number</category><guid>https://magiclen.org/random-number</guid><pubDate>Thu, 1 Oct 2020 20:00:41 +0800</pubDate><dc:creator>Magic Len</dc:creator></item><item><title>如何在C/C++程式語言中使用Rust的函式庫？</title><link>https://magiclen.org/c-rust-library</link><description><![CDATA[    <img src="https://magiclen.org/wp-content/uploads/2019/09/source-code-583537_1920-220x162.jpg" srcset="https://magiclen.org/wp-content/uploads/2019/09/source-code-583537_1920-220x162.jpg 1x, https://magiclen.org/wp-content/uploads/2019/09/source-code-583537_1920-440x324.jpg 2x, https://magiclen.org/wp-content/uploads/2019/09/source-code-583537_1920-660x486.jpg 3x" alt="">
本站先前有介紹過在Rust程式語言中使用C/C++的函式庫的方式，而在這篇文章中會來談談反過來的作法，也就是在C/C++程式語言中使用Rust的函式庫。]]></description><category>研究分享</category><category>C &amp; C++</category><category>Rust</category><category>C/C++</category><category>Rust</category><guid>https://magiclen.org/c-rust-library</guid><pubDate>Thu, 5 Sep 2019 12:00:00 +0800</pubDate><dc:creator>Magic Len</dc:creator></item><item><title>如何在Rust程式語言中使用C/C++的函式庫？</title><link>https://magiclen.org/rust-c-library</link><description><![CDATA[    <img src="https://magiclen.org/wp-content/uploads/2018/04/rust-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2018/04/rust-220x162.png 1x, https://magiclen.org/wp-content/uploads/2018/04/rust-440x324.png 2x, https://magiclen.org/wp-content/uploads/2018/04/rust-660x486.png 3x" alt="">
作為新穎、先進的程式語言，Rust的函式庫還沒有C/C++語言的函式庫來得多且完整。在很多時候，我們還是無可避免地必須要去使用現有C/C++程式語言所實作的函式庫來完成我們需要的功能。雖然一般來說，我們還是會比較喜歡用純Rust程式碼來開發程式，確保程式的安全性以及可移植性，但畢竟要把過去每個C/C++程式語言所實作的函式庫，都使用Rust程式語言來改寫，是非常不切實際的事。在開發成本的考量之下，...]]></description><category>研究分享</category><category>C &amp; C++</category><category>Rust</category><category>C/C++</category><category>Rust</category><guid>https://magiclen.org/rust-c-library</guid><pubDate>Sat, 3 Nov 2018 20:00:47 +0800</pubDate><dc:creator>Magic Len</dc:creator></item><item><title>如何在Rust程式語言中使用全域靜態變數？</title><link>https://magiclen.org/static-lazy-static</link><description><![CDATA[    <img src="https://magiclen.org/wp-content/uploads/2018/04/rust-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2018/04/rust-220x162.png 1x, https://magiclen.org/wp-content/uploads/2018/04/rust-440x324.png 2x, https://magiclen.org/wp-content/uploads/2018/04/rust-660x486.png 3x" alt="">
在使用C或C++程式語言的時候，我們有時會將變數宣告在函數之外，使其可以在任何時間於整個程式的任何scope下使用。使用Java程式語言的時候，也有時會替類別加上「static」的類別(靜態)欄位變數，甚至還可以在「static」區塊中，在類別初始化的時候順便對類別欄位進行初始化的動作。我們把這類宣告在函數、方法之外，且獨立於物件實體的變數稱為「全域靜態變數」(C/C++的全域變數有分能給其它原始...]]></description><category>研究分享</category><category>Rust</category><category>C/C++</category><category>Rust</category><category>lazy_static</category><category>once_cell</category><guid>https://magiclen.org/static-lazy-static</guid><pubDate>Tue, 23 Oct 2018 04:00:46 +0800</pubDate><dc:creator>Magic Len</dc:creator></item><item><title>使用Node.js進行32位元的有號整數運算</title><link>https://magiclen.org/node-js-int32</link><description><![CDATA[    <img src="https://magiclen.org/wp-content/uploads/2017/08/nodejs-napi-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2017/08/nodejs-napi-220x162.png 1x, https://magiclen.org/wp-content/uploads/2017/08/nodejs-napi-440x324.png 2x, https://magiclen.org/wp-content/uploads/2017/08/nodejs-napi-660x486.png 3x" alt="">
JavaScript的Number採用64位元的IEEE 754標準來表示整數和浮點數數值，其中整數的安全範圍在-2^53 - 1到2^53 - 1之間。換句話說，Node.js既不能直接使用到32位元的整數，同時也無法使用64位元的整數。因此，如果要拿Node.js來做一些稍微複雜的計算，就需要撰寫額外的程式來處理資料型態的部份。像是32位元整數經常會遇到的「溢位」，想要在Node.js上重現就...]]></description><category>Rust</category><category>JavaScript</category><category>C/C++</category><category>JavaScript</category><category>node.js</category><category>Node-API</category><category>Rust</category><category>TypeScript</category><category>node-int32</category><guid>https://magiclen.org/node-js-int32</guid><pubDate>Wed, 9 Aug 2017 09:00:26 +0800</pubDate><dc:creator>Magic Len</dc:creator></item><item><title>如何使用Node.js快速搜尋字串？</title><link>https://magiclen.org/node-js-fast-string-search</link><description><![CDATA[    <img src="https://magiclen.org/wp-content/uploads/2017/08/nodejs-napi-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2017/08/nodejs-napi-220x162.png 1x, https://magiclen.org/wp-content/uploads/2017/08/nodejs-napi-440x324.png 2x, https://magiclen.org/wp-content/uploads/2017/08/nodejs-napi-660x486.png 3x" alt="">
字串搜尋是開發程式的時候時常會碰到的議題，由於常用，所以了解一個有效率進行字串搜尋的方式是很重要的。Node.js使用的Chrome V8 JavaScript引擎對於字串處理的效能已經十分良好，在很多情況下只要很直覺地使用原生的JavaScript或Node.js的功能就可以達成最佳效果了。像是字串搜尋，JavaScript的字串本身就有「indexOf」方法可以使用，也有功能強大的「RegEx...]]></description><category>Rust</category><category>JavaScript</category><category>Boyer-Moore-MagicLen</category><category>C/C++</category><category>JavaScript</category><category>字串搜尋</category><category>node.js</category><category>Node-API</category><category>fast-string-search</category><guid>https://magiclen.org/node-js-fast-string-search</guid><pubDate>Tue, 8 Aug 2017 00:00:08 +0800</pubDate><dc:creator>Magic Len</dc:creator></item><item><title>Node.js也能用的StringBuilder</title><link>https://magiclen.org/node-stringbuilder</link><description><![CDATA[    <img src="https://magiclen.org/wp-content/uploads/2017/08/nodejs-napi-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2017/08/nodejs-napi-220x162.png 1x, https://magiclen.org/wp-content/uploads/2017/08/nodejs-napi-440x324.png 2x, https://magiclen.org/wp-content/uploads/2017/08/nodejs-napi-660x486.png 3x" alt="">
有學過Java的人應該會知道「StringBuilder」或是「StringBuffer」這兩個在「java.lang」套件下的類別，常被用來處理需要一直被改變內容的字串。由於Java程式語言一個字串(String)有著不可變物件(Immutable Object)的特性，如果直接使用String類別來進行字串的處理，在改變字串的過程中，每次字串內容的變化將會產生出新的String物件來表示，也導...]]></description><category>C &amp; C++</category><category>JavaScript</category><category>Boyer-Moore-MagicLen</category><category>C/C++</category><category>JavaScript</category><category>node.js</category><category>node-stringbuilder</category><category>Node-API</category><guid>https://magiclen.org/node-stringbuilder</guid><pubDate>Sun, 6 Aug 2017 02:18:27 +0800</pubDate><dc:creator>Magic Len</dc:creator></item></channel></rss>