TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

STB: Single-file public domain libraries for C/C++

85 点作者 seansh超过 1 年前

6 条评论

flohofwoe超过 1 年前
Before the usual confusion starts flooding the comment section:<p>STB-style is different from traditional C++ style &#x27;header-only libraries&#x27; in that the implementation is <i>not</i> parsed and compiled each time the header is included, instead the implementation code sits inside a big ifdef&#x2F;endif block which is only activated at a single include point across the whole project (meaning the implementation is compiled only once in a complete project rebuild, every other include only parses the API declarations at the top of the header and skips the implementation).<p>This means that STB-style libs don&#x27;t suffer from the compile time explosion we are seeing for typical header-only C++ libraries (such as the C++ stdlib headers).<p>You still pay the raw IO cost for skipping the ifdef&#x2F;endif section of course, but this comes down to a couple of seconds for including the file tens-of-thousands of times (which is rarely the case even in large projects since such libraries tend to be isolated in small areas of the projects, such as a single subsystem).
评论 #38900384 未加载
GuestHNUser超过 1 年前
&gt; Why not C99? stdint.h, declare-anywhere, etc.<p>&gt; I still use MSVC 6 (1998) as my IDE because it has better human factors for me than later versions of MSVC.<p>This is really amusing to me. Does anyone know if the author has ever given more detail on why?<p>Also stb is a really great library to look at for those starting C development.
评论 #38898943 未加载
评论 #38898973 未加载
评论 #38900537 未加载
corysama超过 1 年前
stb_image is a stable in gamedev art pipelines.<p>“I just want to load an image. Thank you. Moving on…”
评论 #38899282 未加载
Decabytes超过 1 年前
I’m a C noob, so why aren’t header only files the norm? Seems a lot easier to deal with then a split header and c file
评论 #38900563 未加载
评论 #38899715 未加载
jokoon超过 1 年前
I wish there was the same thing for opengl3.3<p>tinyengine is great but not supported for windows yet
评论 #38903405 未加载
评论 #38904949 未加载
评论 #38900188 未加载
malkia超过 1 年前
Header only libraries are great, and these little gems floating around are super easy to use, until you hit an unsupported (by them) feature, or something that now you have to do (like for year you&#x27;ve been using it for reading, but now you need to write the file, or interleave it, or whatnot).<p>And then you realize you need the official lib - libpng, etc.<p>E.g. it&#x27;s not so simple.
评论 #38899390 未加载
评论 #38899350 未加载
评论 #38899653 未加载
评论 #38900192 未加载
评论 #38900067 未加载