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

> 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?




There 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


I 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).


No, 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)


C 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.


appending _t is not allowed under POSIX, for what that's worth.


Since there are no namespaces in C one kind of weird advantage of this is that raylib will stay out of your own (proper) namespace :)


In 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.


You don't see a lot of C written in lisp-case since it parses as a subtraction.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: