4 ms·
> Written in plain C code (C99) using PascalCase/camelCase notation Is this really something to be proud of? I thought snake_case was the common way of writing
by kramerger 3y ago
> Written in plain C code (C99) using PascalCase/camelCase notation
Is this really something to be proud of? I thought snake_case was the common way of writing C?
- tnecniv 3y agoC styling varies quite a bit between libraries in my experience. Unfortunately, this means your code often looks kind of ugly. The most standard thing I can think of is appending _t to structs / types but I’m pretty sure I’ve used libraries that don’t do that.
- lionkor 3y agoappending _t is not allowed under POSIX, for what that's worth.
- unwind 3y agoThere is no solid standard, since it's C we're talking about. I would kind of agree that lower case is more common. More weirdly (from reading the header [1], I have not worked with raylib) the public types and function names are not namespaced so if your code already used Texture or Camera those become clobbered along with DrawPixel(), InitWindow() and hundreds more (the header is ~1,500 lines). I'm not saying that's bad, and the API seems really nice to work with, it's just a bit odd and against the "common wisdom" on how to design C libraries. I guess for a game there might not be a lot of need for other libraries, since raylib really does a lot of stuff. [1]: https://github.com/raysan5/raylib/blob/master/src/raylib.h https://github.com/raysan5/raylib/blob/master/src/raylib.h
- krstffr 3y agoSince there are no namespaces in C one kind of weird advantage of this is that raylib will stay out of your own (proper) namespace :)
- flohofwoe 3y agoI don't think there's an agreed-upon standard. There's a couple of 'conventions' to avoid collisions between types and names, one would be PascalCase for types and camelCase for anything else, another is using snake_case for both, but use the _t postfix for types (which is a bit shunned upon because the _t postfix is reserved by POSIX - but not the C standard).
- kramerger 3y agoNo, not an standard. But most large C projects seem to use snake case while most C++ projects use Java-case (which OP calls pacal+camel case)
- z3phyr 3y agoIn the non-unix (BeOS,Amiga,NT) world especially video games PascalCase is very popular. But there are exceptions. snake_case has a hacky feel to it, camelCase is very enterprisy and PascalCase says you are from the wirthian world of video games; lisp-case meanse you are into lisp.
- Y_Y 3y agoYou don't see a lot of C written in lisp-case since it parses as a subtraction.