Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
4.9 KiB

  1. FAQ
  2. ---
  3. #### What's the license?
  4. These libraries are in the public domain. You can do anything you
  5. want with them. You have no legal obligation
  6. to do anything else, although I appreciate attribution.
  7. They are also licensed under the MIT open source license, if you have lawyers
  8. who are unhappy with public domain. Every source file includes an explicit
  9. dual-license for you to choose from.
  10. #### <a name="other_libs"></a> Are there other single-file public-domain/open source libraries with minimal dependencies out there?
  11. [Yes.](https://github.com/nothings/single_file_libs)
  12. #### If I wrap an stb library in a new library, does the new library have to be public domain/MIT?
  13. No, because it's public domain you can freely relicense it to whatever license your new
  14. library wants to be.
  15. #### What's the deal with SSE support in GCC-based compilers?
  16. stb_image will either use SSE2 (if you compile with -msse2) or
  17. will not use any SIMD at all, rather than trying to detect the
  18. processor at runtime and handle it correctly. As I understand it,
  19. the approved path in GCC for runtime-detection require
  20. you to use multiple source files, one for each CPU configuration.
  21. Because stb_image is a header-file library that compiles in only
  22. one source file, there's no approved way to build both an
  23. SSE-enabled and a non-SSE-enabled variation.
  24. While we've tried to work around it, we've had multiple issues over
  25. the years due to specific versions of gcc breaking what we're doing,
  26. so we've given up on it. See https://github.com/nothings/stb/issues/280
  27. and https://github.com/nothings/stb/issues/410 for examples.
  28. #### Some of these libraries seem redundant to existing open source libraries. Are they better somehow?
  29. Generally they're only better in that they're easier to integrate,
  30. easier to use, and easier to release (single file; good API; no
  31. attribution requirement). They may be less featureful, slower,
  32. and/or use more memory. If you're already using an equivalent
  33. library, there's probably no good reason to switch.
  34. #### Can I link directly to the table of stb libraries?
  35. You can use [this URL](https://github.com/nothings/stb#stb_libs) to link directly to that list.
  36. #### Why do you list "lines of code"? It's a terrible metric.
  37. Just to give you some idea of the internal complexity of the library,
  38. to help you manage your expectations, or to let you know what you're
  39. getting into. While not all the libraries are written in the same
  40. style, they're certainly similar styles, and so comparisons between
  41. the libraries are probably still meaningful.
  42. Note though that the lines do include both the implementation, the
  43. part that corresponds to a header file, and the documentation.
  44. #### Why single-file headers?
  45. Windows doesn't have standard directories where libraries
  46. live. That makes deploying libraries in Windows a lot more
  47. painful than open source developers on Unix-derivates generally
  48. realize. (It also makes library dependencies a lot worse in Windows.)
  49. There's also a common problem in Windows where a library was built
  50. against a different version of the runtime library, which causes
  51. link conflicts and confusion. Shipping the libs as headers means
  52. you normally just compile them straight into your project without
  53. making libraries, thus sidestepping that problem.
  54. Making them a single file makes it very easy to just
  55. drop them into a project that needs them. (Of course you can
  56. still put them in a proper shared library tree if you want.)
  57. Why not two files, one a header and one an implementation?
  58. The difference between 10 files and 9 files is not a big deal,
  59. but the difference between 2 files and 1 file is a big deal.
  60. You don't need to zip or tar the files up, you don't have to
  61. remember to attach *two* files, etc.
  62. #### Why "stb"? Is this something to do with Set-Top Boxes?
  63. No, they are just the initials for my name, Sean T. Barrett.
  64. This was not chosen out of egomania, but as a moderately sane
  65. way of namespacing the filenames and source function names.
  66. #### Will you add more image types to stb_image.h?
  67. If people submit them, I generally add them, but the goal of stb_image
  68. is less for applications like image viewer apps (which need to support
  69. every type of image under the sun) and more for things like games which
  70. can choose what images to use, so I may decline to add them if they're
  71. too rare or if the size of implementation vs. apparent benefit is too low.
  72. #### Do you have any advice on how to create my own single-file library?
  73. Yes. https://github.com/nothings/stb/blob/master/docs/stb_howto.txt
  74. #### Why public domain?
  75. I prefer it over GPL, LGPL, BSD, zlib, etc. for many reasons.
  76. Some of them are listed here:
  77. https://github.com/nothings/stb/blob/master/docs/why_public_domain.md
  78. #### Why C?
  79. Primarily, because I use C, not C++. But it does also make it easier
  80. for other people to use them from other languages.
  81. #### Why not C99? stdint.h, declare-anywhere, etc.
  82. I still use MSVC 6 (1998) as my IDE because it has better human factors
  83. for me than later versions of MSVC.