Hacker News new | past | comments | ask | show | jobs | submit

Making a 3D modeler in C in a week

https://danielchasehooper.com/posts/shapeup/
I agree entirely with the author on the limitations of Raylib. I'm currently working on a tower-defense style game that I started in Raylib, but I'm running into many of the same limitations (and more). Things such as toggling fullscreen not working consistently across platforms, not being able to enumerate screen modes, toggling rendering features at runtime, saving compiled shaders etc., etc. Having said that, I appreciate Ray's work on this library and will continue to sponsor him. Raylib is great for quickly banging out a prototype, but not much beyond that unless you're okay with living with severe limitations.

Lesson learned, for sure, but I'm too far into the development to swap all of the Raylib stuff out for SDL (or something else) now.

loading story #40240709
loading story #40239909
loading story #40242353
loading story #40242694
loading story #40240118
loading story #40246720
> I agree entirely with the author on the limitations of Raylib.

Wow this is kind of insane. About this

> Raylib doesn’t do basic parameter validation, by design. This function segfaults when dataSize is null: (...)

The developer answered this

> For most of the raylib functions is up to the user to validate the inputs, if raylib should consider all possible bad-use scenarios it would require reviewing most of the library functions and it will increase source-code complexity.

I think the word 'insane' is going to far to describe the behaviour of the specified function.

It returns an array of bytes. If you, the programmer, wrote a line that called that function, on the very next line you are going to try to use the array, realise that you don't know the length, and realise that the `NULL` that passed in on the line above is probably the output for the length!

In order to actually write a call with `NULL` for the dataSize argument, the programmer needs to be clueless about how to write a for loop.

So, no, I can't easily see a situation where a programmer accidentally uses a `dataSize` parameter of `NULL`, because that would mean they don't know that arrays in C have no length information, which is C 101.

loading story #40246828
in c and c++ this is not just normal but almost unavoidable. if your function takes a t* and someone casts a random int to a t* and pass it in, it is gonna segfault. no possible way to validate it, though in theory you could open /proc/self/maps and iterate through it to catch the segfault cases, or install a segfault handler
loading story #40244128
loading story #40257748
loading story #40241215
loading story #40242863
loading story #40240387
loading story #40240656
loading story #40240736
loading story #40258642
loading story #40243446
loading story #40245310
loading story #40242695
loading story #40243811
loading story #40241166
loading story #40242468
loading story #40243124
loading story #40240481
loading story #40240021
loading story #40243310
loading story #40240922
loading story #40243293
loading story #40244341
loading story #40243206
loading story #40239645
loading story #40240822
loading story #40246896
loading story #40243729
loading story #40242912
loading story #40240309
loading story #40241599
loading story #40240921
loading story #40240130
loading story #40257282
loading story #40240857
loading story #40249930
loading story #40245546
loading story #40245223
loading story #40243198