HNHacker News
TopNewBestAskShowJobs

hgs3

1,590 karma · joined August 11, 2020

submissionscomments
hgs3··on Show HN: I built an embeddable Unicode library with MISRA C conformance
Primarily, companies developing for embedded systems or other resource constrained devices.
hgs3··on Show HN: I built an embeddable Unicode library with MISRA C conformance
This is the most ironic typo I've ever made. Thanks for the catch. I've corrected it.
hgs3··on Show HN: I built an embeddable Unicode library with MISRA C conformance
I went back and forth on this and in my uncertainty I decided it was better to start more "closed" first with the potential to become more "open" over time.
hgs3··on Show HN: I built an embeddable Unicode library with MISRA C conformance
> I would like to know how does it compare against ICU

ICU is a large library, typically around ~40 MB depending on the platform, whereas Unicorn, with all features enabled, is only about 600 KB.

ICU has a broader scope: it's not just a Unicode library, but also an internationalization library. Unicorn, on the other hand, is specifically focused on Unicode algorithms.

ICU wasn't designed to be customized. It's also non-MISRA compliant and written in C++11. In contrast, Unicorn is written in C99, fully customizable, MISRA compliant, and only requires a few features from libc [1]. It's far more portable.

[1] https://github.com/railgunlabs/unicorn/?tab=readme-ov-file#u...

hgs3··on Show HN: I built an embeddable Unicode library with MISRA C conformance
Unfortunately, the entire reason I didn't release Unicorn under an OSI approved license is because I see many (most?) FOSS projects are chronically underfunded. Now, I did not quit my job and build this to get rich or anything, but I do need to earn enough to sustain myself. If there's enough interest, I would consider crowdfunding a release under an OSI license.
hgs3··on Show HN: I built an embeddable Unicode library with MISRA C conformance
Thank you, let me know if you have any questions.
hgs3··on From where I left
> Many people had contributed their efforts to the Redis project for free

It's worth noting that the bulk of the code was written by antirez with only ~12 others exceeding 100+ commits [1]. And if you continue scrolling the number of commits-per-user drops off fast. It's striking given how famous the project is.

[1] https://github.com/redis/redis/graphs/contributors

hgs3··on Good union types in Go would probably need types without a zero value
The public backing by Google absolutely propelled Go into the spotlight, but Dart, also released by Google, hasn’t achieved anywhere near the same success. Considering how long ago Go was released, if the language didn't have its own merit, it would have fizzled out by now and failed to sustain its momentum or foster such a strong community.
hgs3··on JSON5 – JSON for Humans
I'm looking at the JSON5 spec and it appears it does not introduce a capital \U escape sequence for Unicode characters outside the Basic Multilingual Plane (BMP). It's not brought up often, but in JSON you do need UTF-16 surrogates to write an escape sequence for Unicode characters outside the BMP. Consider the Hamburger Emoji (U+1F354). Instead of escaping it as "\U0001F354", you need to escape it with UTF-16 surrogates "\uD83C\uDF54". This is both cumbersome for humans and not in accordance with the Unicode Standard [1]. It's ironic, but many (most?) of the "JSON for Humans" flavors of JSON tend to overlook this.

[1] See Chapter 3.8 "Surrogates" of the Unicode Standard.

hgs3··on Just: Just a Command Runner
I think there's been a misunderstanding.

> Your first sentence says

My first sentence was me quoting the Just manual and my second sentence was my observation about what that suggests. I wasn't asserting whether it's true or not, just sharing my interpretation, as I'm not familiar with Just.

> And then you go ahead and complain that it is poor at building.

I did not "complain" I stated that incremental builds, regardless of whether Just has them or not, is one feature I personally like about Make.

Going by the responses I received, Just does not appear to support incremental builds and a simple acknowledgement, minus the vitriol, would have sufficed.

hgs3··on Just: Just a Command Runner
> I’ve always had incremental happen with language-native tooling like `go` or `cargo`

That makes sense, but for me, Make is incredibly useful for incremental file processing outside of programming. I've written tiny Makefiles that use glob patterns to batch-convert thousands of SVGs into PNGs and WebPs, but only for the modified SVG files. I've used Make to batch-convert modified LaTeX files to PDFs and render modified Blender projects into WebM videos for the web. Rendering videos is very time-consuming, so only rendering modified video files is a huge win.

hgs3··on Just: Just a Command Runner
The manual states that "just is a command runner, not a build system," and mentions "no need for .PHONY recipes!" This seems to suggest that there's no way to prevent Just from rebuilding targets, even if they are up-to-date. For me, one of the key advantages of using Make is its support for incremental builds, which is a major distinction from using a plain shell script to run some commands.
hgs3··on UTF-8 characters that behave oddly when the case is changed
This isn't "odd" behavior. It's a consequence of using a multibyte encoding scheme. Also, when dealing with case mapping, you can't assume that the character count will remain constant. This is because in Unicode full case mappings can map a character to multiple characters, meaning you might end up with more characters than you started with, regardless of the encoding used.
hgs3··on Feds: Critical Software Must Drop C/C++ by 2026 or Face Risk
You can have a systems programming language with garbage collection. Most concerns regarding GC are around unpredictable pauses, but you can absolutely design a predictable GC suitable for real-time applications.

Rust is not the only option. The Ada programming language was developed in the early 1980s, primarily for the U.S. Department of Defense (DoD). Ada was designed for safety-critical embedded systems and real-time applications, especially in areas like avionics and military systems. In 1991 the DoD mandated Ada, but then reversed the decision in 1997. As I read the linked article and the governments "strong stance" I'm wondering if history will repeat itself.

hgs3··on Alan Kay on Messaging (1998)
In practice it means late binding [1].

[1] https://en.wikipedia.org/wiki/Late_binding

hgs3··on Synfig Studio – Open-Source 2D Animation Software
I recently used Synfig for some simple animations and had an overall good experience. Inkscape natively supports saving to the Synfig format, making it easy to import and animate my vector art. Synfig saves animations in an XML file format, which simplifies tracking changes in version control. If you're interested in trying Synfig, there is an official tutorial series on YouTube [1].

[1] https://youtube.com/playlist?list=PLJ1s8hm5LwbTlUt_kOmQ04hK5...

hgs3··on The lost language extensions of MetaWare's High C compiler (2023)
Related: The 'lcc-win' C compiler added operator overloading, default function arguments, and function overloading (see "generic functions") [1]. The Plan 9 C compiler introduced several language extensions, some of which, like anonymous structs/unions would eventually be incorporated into the C standard. Present day GCC accepts the -fplan9-extensions flag [2] which enables some nifty features, like automatically converting a struct pointer to an anonymous field for function calls and assignments.

[1] https://lcc-win32.services.net/C-Tutorial.pdf

[2] https://gcc.gnu.org/onlinedocs/gcc/Unnamed-Fields.html

hgs3··on Committing to Rust in the Kernel
> RAII and smart pointers and borrow checker are all signs of "individual element thinking"

I'd call it object-oriented thinking. To me Rust and modern C++ are attempting to "OO-ify" systems programming and I think you get push back from folks who view their resources more holistically.

hgs3··on I Like Makefiles
There is much misunderstanding about Makefiles, what they are, and what they are not. Make is not a "programming language build system" as some would imply, but rather a recipe builder. With Make you provide the file you want built, the shell commands to build it, and any files the build depends on.

Here's a simple example to get you started. Create a file named "Makefile" with the following text and an empty file alongside it named foo.txt.

    bar.txt: foo.txt
        cp foo.txt bar.txt
When you run the "make" command in your shell it will check if the "bar.txt" file exists. If it does not exist OR if "foo.txt" has a newer timestamp, then it will rebuild "bar.txt" by executing the tab indented shell commands underneath. In this case, the only shell command used is the 'cp' command. In the linked article the author invokes npm, bundler, and netlify.

When people use Make to compile their C code they are simply invoking the C compiler just like they would any other shell command. You might have seen something in a Makefile that looks like this:

    foobar.o: foobar.c
        gcc -c foobar.c
This is just saying: "The output file 'foobar.o' depends on the input file 'foobar.c' and to build 'foobar.o' run the shell command 'gcc -c foobar.c'" which is conceptually the same as my previous example were we built "bar.txt". Since explicitly listing every .o and .c file in a Makefile is tedious, many authors opt for wildcards.

I hope this helped!

hgs3··on DirectX Adopting SPIR-V as the Interchange Format of the Future
> Khronos already mentioned in a couple of conferences that there will be no further work improving GLSL

Unfortunately, HLSL isn’t an open standard like GLSL. Is it Khronos's intention to focus solely on SPIR-V moving forward, leaving the choice of higher-level shader languages up to application developers?

hgs3··on Bitten by Unicode
Unicode conforming regular expression engines are supposed to support the \p or \P property syntax [1] so you should be able to match hyphen characters with \p{Hyphen} or \p{Dash}.

[1] https://www.unicode.org/reports/tr18/#property_syntax

hgs3··on C2y Proposal: Essential Effects for C
As the proposal points out there are already a number of projects for adding an effect system to C. There are also other approaches to aid in correctness, from formal methods to coding standards like MISRA. I think merging any approach into the C standard would be problematic because (1) it limits perceived choice by “blessing” one approach over others and (2) it standardizes an approach which history might prove to be flawed. I would encourage the authors to consider implementing their effect system as a separate tool and observe its practical reception.
hgs3··on SDL3 new GPU API merged
But why does the GPU API need to be in mainline SDL? Couldn't it be a separate project like SDL_net, SDL_mixer, SDL_image, and SDL_ttf? I would think that as a separate project "SDL_gpu" could be versioned independently, evolve independently, and not be obligated to support every platform SDL itself supports. In fact if "SDL_gpu" only required a windowing context, then it could presumably integrate with SDL2 and non-SDL applications!
hgs3··on I prefer rST to Markdown
> something HTML-based

Instead of HTML you can use XML to write structured documents. With XML you can define whatever custom tags you need with schema validation if desired. The advantage of this approach is you have full control over the input schema and output, but the downside is XML is much more syntactically noisy compared to Markdown or RST and you will need a script to parse & convert the XML to your preferred output format(s).

hgs3··on Call of Duty: Warzone Caldera Data Set for Academic Use
Right or wrong licensing source code separately from data isn't a new thing. I can think of some very famous video games that have released their source code under a Free Software license, but kept the game data proprietary.

According to the FSF there is a separation between data and code [1] (search for "data" on that page). They specifically say that data inputted or outputted by a program isn't affected by the programs license which indicates a separation from their perspective.

[1] https://www.gnu.org/licenses/gpl-faq.en.html

hgs3··on Translating All C to Rust (TRACTOR)
In the case of OpenSSL, Big Tech clearly neglected proper support until after the Heartbleed vulnerability. Prior to Heartbleed, the OpenSSL Software Foundation only received about $2K annually in donations and employed just one full-time employee [1]. Given the projects critical role in internet security, Big Techs neglect raises concerns about their quality assurance practices for less critical projects.

The OpenSSL Foundation is not exempt from criticism despite inadequate funding. Heartbleed was discovered by security researches using fuzz testing, but proactive fuzz testing should have been a standard practice from the start.

[1] https://arstechnica.com/information-technology/2014/04/tech-...

hgs3··on How to use the new counted_by attribute in C (and Linux)
Worth noting the analog in MSVC is SAL annotations [1].

[1] https://learn.microsoft.com/en-us/cpp/code-quality/annotatin...

hgs3··on I'm not a fan of strlcpy(3)
Yes, truncating a user facing string requires more consideration regardless of programming language. For example do you truncate at the grapheme, word, sentence, new line, paragraph, or something else? How do you indicate truncation to the user, with an ellipsis perhaps? If you use an ellipsis is it appended to the original string or drawn by the GUI toolkit?

Note that the Unicode grapheme cluster, word, sentence, and line break algorithms are locale specific. Now consider how often programmers casually truncate strings, even in high-level languages, without accounting for the locale.

hgs3··on I'm not a fan of strlcpy(3)
There is also strscpy [1] which behaves like the authors use of memccpy except the former doesn’t require manually passing the null terminator as an argument.

[1] https://manpages.debian.org/testing/linux-manual-4.8/strscpy...

hgs3··on RegreSSHion: RCE in OpenSSH's server, on glibc-based Linux systems
Yes, the Debian 12 fix is out. You can verify you're patched by running 'ssh -V' and verifying you see 'deb12u3'. If you see 'deb12u2' then you're vulnerable [1].

[1] https://security-tracker.debian.org/tracker/CVE-2024-6387

← PreviousPage 4 of 21Next →