> Btw, Floh in that code snippet, it would be good to change the > 'vertices' and 'indices' arrays to be 'const' so that the compiler > will have an easy time to avoid placing them on the stack...
Does the compiler actually this sort of magic with const? I was only aware of static. But yes, real world code wouldn't place such data on the stack. In the samples I just wanted to make clear (and also test) that the initialization data doesn't need to stick around for the lifetime of the buffer, instead it is copied into the buffer (or image) inside the sg_make_xxx calls. As for 64 KByte as default, I'm a bit divided. On one hand I agree with you guys that it's better to have a small default which breaks early instead of a big default which wastes memory for 99% of projects. On the other hand, platform-specific compiler/linker options are a bit of a hassle in cross-platform build scripts. I'd prefer a "useful default" which is "good enough" for many projects. E.g. I can already see the "flood" of issues asking why the code using my libraries causes errors in WASM even though they did everything "exactly like in the sample code" ;) (after all, it looks like the default initial memory is 16 MBytes, and 64 KBytes of 16 MBytes is just 0.4% (if my math is right), IMHO a bit more "waste" for the stack would be acceptable) Cheers! -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/71303cf3-2d27-4dfa-b17c-bf000edddca6n%40googlegroups.com.
