News for hackers. Stuff that matters.
Re:Nuklear: A single-header ANSI C GUI library by kilpikaarna on Saturday February 10, 2018 @11:42AM (#16348030)
Especially when that single header is over 13k lines and reimplements half the standard library. This looks pretty cool and I have an idea for an OpenGL project that needs a GUI, so I'll probably try it out at some point, but it doesn't really seem as lean and straightforward as the blurb implies...
Re:Nuklear: A single-header ANSI C GUI library by naivete on Saturday February 10, 2018 @07:04PM (#16350368)
There isn't really that much unnecessary stuff in there. It's more like 20k LoC but half of it is comments. And if included as a header most of it will get stripped away by the preprocessor.

Just for context, in C++ including std::string (after preprocessing) will pull in 25k LoC, std::vector around 20k.

Programming in C++ by the book will average around 35k LoC per every compilation unit. And it will compile significantly slower than C code.

Having that in mind, and considering that Nuklear doesn't pull in any dependencies, not even C stdlib parts. I think author has done a good job at being lean and fairly straightforward.

UI libs are usually a huge dependency and a hairy mess. This is not really the case. It's just one ~1mb 20k line header file.

There is some overhead on preprocessing over having a .c/.h combo, but that's it.

Re:Nuklear: A single-header ANSI C GUI library by dangerbird2 on Saturday February 10, 2018 @12:04PM (#16348162)
Reimplementing parts of the standard library is important for applications where you don't neccessarily have access to a standards-compliant libc (read Windows), or if you have need custom malloc/free implementations. Similar techniques are used in automake and similar build generators to provide non-standard libc function implementations. precompiled headers can help with the fact that good portions of the header will be #ifdef'ed away.
Re:Nuklear: A single-header ANSI C GUI library by asveikau on Saturday February 10, 2018 @12:17PM (#16348253)
I think you completely missed the point of what you're replying to.

You can put those reimplentations in a different file. You don't have to expose the consumer of the library to them by jamming the whole thing, both interface and implementation, in a single header.

This is like library design by the folks who mistakenly say that what they do with '#include <stdio.h>' is they are "including a library". Eg. Compile and link are the same thing in a lot of people's minds, I think increasingly these days as C expertise is diminishing.

Re:Nuklear: A single-header ANSI C GUI library by pjmlp on Sunday February 11, 2018 @03:30AM (#16351779)
Yeah it looks like they are afraid of touching a linker.
Re:Nuklear: A single-header ANSI C GUI library by banachtarski on Saturday February 10, 2018 @01:16PM (#16348620)
I develop on linux primarily but occasionally windows also. The stdlib is totally fine! When did you last compile on Windows? 2011?
Re:Nuklear: A single-header ANSI C GUI library by pjmlp on Monday February 12, 2018 @03:28AM (#16357314)
All Windows compilers have ANSI C compliant libraries.
Re:Nuklear: A single-header ANSI C GUI library by FraKtus on Sunday February 11, 2018 @04:17AM (#16351908)
once you grasp the concept of immediate mode it is straight forward. You need to parse system events and feed them to Nuklear, then you make a single function that will draw your interface and update the application state variables you need. I like a lot the fact that within just a few lines of code I can have a GUI and focus on the main work...