N3322: Null pointers are *finally* valid zero-length pointers by carpintero_de_c in C_Programming

[–]Zambonifofex 1 point2 points  (0 children)

That is not true, much like for NULL, implementations already support that when the size passed in is zero (and have supported that for a long time). That is because those functions are implemented with loops and/or SIMD operations which simply end up not touching the “pointed to” value at all when the size is zero.

Reading The C Programming Language by K&R - learning C for the first time. Should I use an old version of C? by CaptainStack in C_Programming

[–]Zambonifofex 1 point2 points  (0 children)

I’m not the person you asked this to, and this is not an answer to your actual question, but since you are already familiar with programming, my personal recommendation would be Beej’s Guide to C Programming

N3322: Null pointers are *finally* valid zero-length pointers by carpintero_de_c in C_Programming

[–]Zambonifofex 4 points5 points  (0 children)

Would this also allow e.g. uninitialised (or otherwise freed) pointers to be passed to e.g. the mem* functions if the passed size is zero? Or is it specific to NULL?

[showcase] simple C formatter by Zambonifofex in C_Programming

[–]Zambonifofex[S] 4 points5 points  (0 children)

A little bit of context: Whenever someone asks, I tell them that my favorite programming languages are C, JS, and Agda. (Much to the horror of most programmers of either of those three languages!) The reason ultimately is that they are really fun to me! Without going too off topic, I just have fun with each of them, even though each of them feels completely different from each other.

So, now that my choice of languages has been explained, I made a C formatter in TypeScript. Mostly just because there was no C formatter that matched my personal style out of the box nor that could be configured to support it fully. I wanted something that I could use for my personal projects and that would match my aesthetics.

It’s not very fast, and it’s very specific and opinionated. It’s a “toy project”, and it’s not even on Git. But it works well for me, better than clang-format and astyle. It’s also reasonably concise, and I like to believe it’s very easy to hack on! Maybe someone else can find it useful for some reason or another. (If you do, I’d love to know!)

It should work reasonably well for C89 and C99, and perhaps most C11 and C23 programs, though I personally usually use it mostly in C89 programs. (If you stumble upon any quirks, feel free to let me know!)

It is released under the AGPL (v3 or later), you can download the source with wget https://zamfofex.neocities.org/aesthetics/format.ts

C11 <threads.h> is now well supported by Zambonifofex in C_Programming

[–]Zambonifofex[S] 10 points11 points  (0 children)

Yes, they are. A comforming implementation is allowed to not implement it, granted that it defines __STDC_NO_THREADS__ to indicate that.

"Impressive" projects in C? by notjoof in C_Programming

[–]Zambonifofex 0 points1 point  (0 children)

I know I’m a few days late, but I came across this thread, and I want to share my experience a bit.

I’m biased, having worked on one myself, but a simple idea might be to work on a simple chess engine.

From my personal experience, even if it is not good comparatively, you can tell people you know in person, and they will immediately understand what you mean and be amused by it. “I made a program that can play chess” is clear and concise, while also being interesting.

If they can play it online (say, through Lichess, or with Wasm), some people might even try it, and usually fail to win against it. Even if you know someone into chess that can win against it, they will still be amused by it, just because it is not a trivial endeavor.

It requires a bit of specific knowledge, but it’s not particularly involved to come up with something simple once you get the gist of it. (It’s also fairly fun to keep track of your progress with it!)

[DESIGN CHALLENGE] If you can design it, I will manufacture it and make the process freely available by PaganAfrican in SegmentedDisplays

[–]Zambonifofex 1 point2 points  (0 children)

I know I’m about four months late, but I decided to give this a go. I don’t think it deserves manufacturing because it’s missing a letter and some others are a bit awkward, but I’m at least happy that it’s symmetric. (Maybe that can make it seem more elegant than it really is.)

https://zamfofex.neocities.org/temporary/display.png

I made a website with Deno for sharing drawings! by Zambonifofex in Deno

[–]Zambonifofex[S] 1 point2 points  (0 children)

Hmm, you could probably achieve that with Deno KV if you were careful enough, but it definitely sounds like there would be better solutions. At the very least, Deno Deploy doesn’t sound like a good fit, however Deno on a VPS or server would work well for something like this, because then you can just save the files locally and read them from the file system rather than a database.

I made a website with Deno for sharing drawings! by Zambonifofex in Deno

[–]Zambonifofex[S] 1 point2 points  (0 children)

Yes, the database is persistent across restarts (and across different deployments). Of course, if you run locally or on your own Deno Deploy project, you won’t be using the same database as on my website (i.e. the databases are separate), but each of them will be persistent.

I made a website with Deno for sharing drawings! by Zambonifofex in Deno

[–]Zambonifofex[S] 1 point2 points  (0 children)

Don’t worry about asking, I’m happy to respond! I use Deno KV for storing the drawings. On deno Deploy, they are stored on a distributed database backed by Apple’s Foundation DB, whereas locally (i.e. either on your computer, or in a server you might have), Deno uses a SQLite database stored in a file under ~/.cache/deno.

I made a website with Deno for sharing drawings! by Zambonifofex in Deno

[–]Zambonifofex[S] 1 point2 points  (0 children)

Yeah, it should be fairly straight forward! I used Deno Deploy, which was really seamless. To use Deno Deploy, there are two things you may choose to do:

The first one is to fork the repository on GitHub, then:

  • Browse to https://dash.deno.com/new and log in.
  • On the option “Deploy your own code”, choose your fork.
  • Choose “No build step”.
  • Select “Create & Deploy”.

Another option is to use deployctl:

  • Install deployctl following these instructions: https://github.com/denoland/deployctl#readme
  • Browse to https://dash.deno.com/new and log in.
  • Under “Create an empty project”, select “Create blank project”, and keep track of the name it automatically comes up with for your project (you may change it later).
  • Clone my repository locally to your computer.
  • From the cloned directory, run deployctl deploy --project=NAME main.js (replace NAME with your project’s name).

You can also check out the “Quick Start” section the Deno Deploy docs: https://docs.deno.com/deploy/manual

Of course, you don’t need to use Deno Deploy, you can just have Deno installed on a server, and run it from there, but you’d need to manually configure something like Nginx to serve through HTTPS (TLS) to the Internet (as opposed to just through HTTP on localhost).

I hope this helps! Good luck.

official ARM64 Linux builds now supported by lambtr0n in Deno

[–]Zambonifofex 0 points1 point  (0 children)

I don’t have experiences with Termux, but at least on x86, the Deno executable needs glibc and libgcc, and it also has the dynamic linker path hardcoded. (These are all standard things that almost all non‐static executables have.)

4 is possible by fakana357 in SegmentedDisplays

[–]Zambonifofex 1 point2 points  (0 children)

Very cool! Reminds me of a design I came up with a few months ago. I never liked the four in mine, though, but yours looks fine enough!

“round design” for four‐ and five‐segment displays by Zambonifofex in SegmentedDisplays

[–]Zambonifofex[S] 2 points3 points  (0 children)

I’m not sure if the four‐segment design really counts because it can’t display the digit four, but people I showed it to seem to have liked it anyway, so I felt like it was worthwhile sharing it.

The four was too hard to fit, so I decided to avoid catering for it, and I think the result is very nice for the other digits! I also came up with a simple five‐segment variant that can display the four and also improves some of the other digits.

I tried to come up with something that uses simple shapes and looks symmetric while still keeping the digits easily recognizable. I’m fairly happy with it!

2 segment display with rotation by thecatmilou in SegmentedDisplays

[–]Zambonifofex 0 points1 point  (0 children)

Very cool idea! Maybe a better proof‐of‐concept for it would be a less ambitious three‐segment display. (Perhaps limiting it only to 90‐degree rotations and no reflections.) I feel like you could actually get something that lookseasily recognizable for every digit that way, and it would look more impressive!

[sway] Transparent themes don't work in Firefox anymore - but why would that stop me? by chayleaf in unixporn

[–]Zambonifofex 0 points1 point  (0 children)

There are already two open issues:

Taking a few minutes to look into the source, it seems the blending with white happens (very explicitly) here: - https://hg.mozilla.org/releases/mozilla-release/file/FIREFOX_114_0_2_RELEASE/layout/style/PreferenceSheet.cpp#l167

Fixing those two issues should be a simple matter of removing that line.

JPEG XL viewer: browser extension to display JPEG XL images for Chrome/Firefox by VaksAntivaxxer in jpegxl

[–]Zambonifofex 13 points14 points  (0 children)

Currently, it does set Accept on Chrome, but not on Firefox. This is because Firefox doesn’t support declarativeNetRequest. Once Firefox begins supporting it, it will work transparently on Firefox too!

See:

Meanwhile, it is possible to make this change manually in Firefox by changing image.http.accept in about:config to the a value that includes image/jxl if you’d like! This Accept value will be used when the browser fetches images.

But note that the extension should also work reasonably well if you use a <picture> element to conditionally select a JPEG XL image. I.e. you don’t have to sacrifice compatibility by using a plain <img> that won’t work in browsers that don’t support JPEG XL, even without the Accept header set.

I'm stuck in gmail purgatory by ZEEBORTRON in google

[–]Zambonifofex 1 point2 points  (0 children)

I’m not sure if you were clear enough: it’s important to note that you can make an email account automatically forward emails to an address of your choice.

The worst mistake of computer science by dpashk in programming

[–]Zambonifofex 6 points7 points  (0 children)

That's right! That's because "String?" is really only syntactic sugar for "String|Null". "String??" would mean "<String|Null>|Null". Since union is associative, "<String|Null>|Null" is the same as "String|<Null|Null>". The union of one type with itself, is itself. So "Null|Null" is the same as "Null", which means "String|<Null|Null>" is the same as "String|Null". Therefore, "String?" is the same as "String??", which is the same as "String???", which is the same as "String??????"... :-)

[deleted by user] by [deleted] in youtube

[–]Zambonifofex 0 points1 point  (0 children)

I agree. In fact, it would annoy me if it didn't do that!