Skip to content

Commit

Permalink
README: clarify C++ (non/half-)compatibility of DG_dynarr.h
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielGibson committed May 5, 2016
1 parent f17cbb1 commit 1a29571
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Some standalone source files that don't deserve their own repositories.
| File | Description |
|-------------------------------|----------------|
| [**DG_misc.h**](/DG_misc.h) | A public domain single-header C/C++ library with some useful functions to get the path/dir/name of the current executable and misc. string operations that are not available on all platforms - [***List of Functions***]( #list-of-functions-in-dg_misch) |
| [**DG_dynarr.h**](/DG_dynarr.h) | A public domain single-header C/C++ library providing typesafe dynamic arrays for plain C, kinda like C++ std::vector. - [***Usage Example and List of Functions***]( #example-and-list-of-functions-for-dg_dynarrh) |
| [**DG_dynarr.h**](/DG_dynarr.h) | A public domain single-header library providing typesafe dynamic arrays for *plain C*, kinda like C++ std::vector (works with C++, but only with "simple" types) - [***Usage Example and List of Functions***]( #example-and-list-of-functions-for-dg_dynarrh) |
| [**SDL_stbimage.h**](/SDL_stbimage.h) | A public domain header-only C/C++ library for converting images to [SDL2](http://libsdl.org) `SDL_Surface*` using [stb_image.h](https://github.com/nothings/stb) - [***List of Functions***]( #list-of-functions-in-sdl_stbimageh) |
| [**sdl2_scancode_to_dinput.h**](/sdl2_scancode_to_dinput.h) | One static C array that maps SDL2 scancodes to Direct Input keynums (values of those DIK_* constants) - also public domain. |
| [**ImgToC.c**](/ImgToC.c) | Commandline tool converting images to .c files with a struct containing the image data. Same format as Gimp's "Export as .c" feature. Needs [stb_image.h](https://github.com/nothings/stb/) |
Expand Down Expand Up @@ -226,6 +226,12 @@ Notable exceptions are the value arguments (`v`) of `da_push()`, `da_set()`
and `da_insert()`, so it's still ok to do `da_push(arr, fun_with_sideffects());`
or `da_insert(a, 3, x++);`.
This library is inteded to be used with ***plain C*** code, but it also works with *C++*; however you
should only use it with "simple" types that can be moved around with `memcpy()`, i.e. don't
require copy- or move-constructors or destructors to work correctly.
So if you're writing C code that should also compile as C++ use this, but if you're
writing "real" C++ code, use `std::vector` or something else instead.
Furthermore, by default some sanity checks (like "is idx valid?") are done using
assertions and by returning NULL/doing nothing on error if possible.
As this has some overhead, the behavior can be controlled with
Expand Down

0 comments on commit 1a29571

Please sign in to comment.