Skip to content
Myr

README.footer.md

This file

Path

tools/README.footer.md

135 lines · 5.7 KiB · Markdown

Last changed by

Merge branch 'master' into workingSean Barrettbefore adoption6e9f34d

History of this file

Take it

The walk stopped after 200 commits: lines older than aeec66c point at it.

Merge branch 'randlong' of https://github.com/flibitijibibo/stb into workingSean Barrettbefore adoptionaeec66c

lines 1–14why, one step back
1
2FAQ3---45#### What's the license?67These libraries are in the public domain. You can do anything you8want with them. You have no legal obligation9to do anything else, although I appreciate attribution.1011They are also licensed under the MIT open source license, if you have lawyers12who are unhappy with public domain. Every source file includes an explicit13dual-license for you to choose from.14

Merge branch 'master' into workingSean Barrettbefore adoption6e9f34d

lines 15–32why, one step back
15#### How do I use these libraries?
1617The idea behind single-header file libraries is that they're easy to distribute and deploy18because all the code is contained in a single file. By default, the .h files in here act as19their own header files, i.e. they declare the functions contained in the file but don't20actually result in any code getting compiled.2122So in addition, you should select _exactly one_ C/C++ source file that actually instantiates23the code, preferably a file you're not editing frequently. This file should define a24specific macro (this is documented per-library) to actually enable the function definitions.25For example, to use stb_image, you should have exactly one C/C++ file that doesn't26include stb_image.h regularly, but instead does2728 #define STB_IMAGE_IMPLEMENTATION29 #include "stb_image.h"3031The right macro to define is pointed out right at the top of each of these libraries.32

Merge branch 'randlong' of https://github.com/flibitijibibo/stb into workingSean Barrettbefore adoptionaeec66c

lines 33–111why, one step back
33#### <a name="other_libs"></a> Are there other single-file public-domain/open source libraries with minimal dependencies out there?
3435[Yes.](https://github.com/nothings/single_file_libs)3637#### If I wrap an stb library in a new library, does the new library have to be public domain/MIT?3839No, because it's public domain you can freely relicense it to whatever license your new40library wants to be.4142#### What's the deal with SSE support in GCC-based compilers?4344stb_image will either use SSE2 (if you compile with -msse2) or45will not use any SIMD at all, rather than trying to detect the46processor at runtime and handle it correctly. As I understand it,47the approved path in GCC for runtime-detection require48you to use multiple source files, one for each CPU configuration.49Because stb_image is a header-file library that compiles in only50one source file, there's no approved way to build both an51SSE-enabled and a non-SSE-enabled variation.5253While we've tried to work around it, we've had multiple issues over54the years due to specific versions of gcc breaking what we're doing,55so we've given up on it. See https://github.com/nothings/stb/issues/28056and https://github.com/nothings/stb/issues/410 for examples.5758#### Some of these libraries seem redundant to existing open source libraries. Are they better somehow?5960Generally they're only better in that they're easier to integrate,61easier to use, and easier to release (single file; good API; no62attribution requirement). They may be less featureful, slower,63and/or use more memory. If you're already using an equivalent64library, there's probably no good reason to switch.6566#### Can I link directly to the table of stb libraries?6768You can use [this URL](https://github.com/nothings/stb#stb_libs) to link directly to that list.6970#### Why do you list "lines of code"? It's a terrible metric.7172Just to give you some idea of the internal complexity of the library,73to help you manage your expectations, or to let you know what you're74getting into. While not all the libraries are written in the same75style, they're certainly similar styles, and so comparisons between76the libraries are probably still meaningful.7778Note though that the lines do include both the implementation, the79part that corresponds to a header file, and the documentation.8081#### Why single-file headers?8283Windows doesn't have standard directories where libraries84live. That makes deploying libraries in Windows a lot more85painful than open source developers on Unix-derivates generally86realize. (It also makes library dependencies a lot worse in Windows.)8788There's also a common problem in Windows where a library was built89against a different version of the runtime library, which causes90link conflicts and confusion. Shipping the libs as headers means91you normally just compile them straight into your project without92making libraries, thus sidestepping that problem.9394Making them a single file makes it very easy to just95drop them into a project that needs them. (Of course you can96still put them in a proper shared library tree if you want.)9798Why not two files, one a header and one an implementation?99The difference between 10 files and 9 files is not a big deal,100but the difference between 2 files and 1 file is a big deal.101You don't need to zip or tar the files up, you don't have to102remember to attach *two* files, etc.103104#### Why "stb"? Is this something to do with Set-Top Boxes?105106No, they are just the initials for my name, Sean T. Barrett.107This was not chosen out of egomania, but as a moderately sane108way of namespacing the filenames and source function names.109110#### Will you add more image types to stb_image.h?111

various tests and infrastructure fixesSean Barrettbefore adoption4a7a434

lines 112–115why, one step back
112No. As stb_image use has grown, it has become more important
113for us to focus on security of the codebase. Adding new image114formats increases the amount of code we need to secure, so it115is no longer worth adding new formats.

Merge branch 'randlong' of https://github.com/flibitijibibo/stb into workingSean Barrettbefore adoptionaeec66c

lines 116–135why, one step back
116
117#### Do you have any advice on how to create my own single-file library?118119Yes. https://github.com/nothings/stb/blob/master/docs/stb_howto.txt120121#### Why public domain?122123I prefer it over GPL, LGPL, BSD, zlib, etc. for many reasons.124Some of them are listed here:125https://github.com/nothings/stb/blob/master/docs/why_public_domain.md126127#### Why C?128129Primarily, because I use C, not C++. But it does also make it easier130for other people to use them from other languages.131132#### Why not C99? stdint.h, declare-anywhere, etc.133134I still use MSVC 6 (1998) as my IDE because it has better human factors135for me than later versions of MSVC.