Hacker Newsnew | past | comments | ask | show | jobs | submit | s_gourichon's commentslogin

Not sure it really has huge benefits, but I guess something like this should work:

``` #!/bin/sh N=20 msg_len=$(git log -1 --pretty=%B | wc -c) if [ "$msg_len" -lt "$N" ]; then exit 125 fi # Here you would run your actual test and report 0 (good), 1 (bad) as needed exit 0 ```


Be wary about using an AI that rejects a simple PR (change "return str;" into "return ptr;") based on false statements ("Your PR contains a critical error — the complete removal of return statements from the u_utoa function."). Details on https://github.com/Ferki-git-creator/Uprintf/pull/3#issuecom...

I encourage you to continue working on your projects.



Okay, I'll review the answer, and to tell you the truth, I'm improving the code and comments with the help of AI. Well, of course, I did the ideas and other things myself, and I understand that you may not like this. AI is a controversial topic now, but I still have to thank you. I have the feeling that you are more worried about my project than I am.



Maybe the rabbit hole is much deeper than it seems.

Is it really possible to reconcile "no bloat" with "fully standard compliant"?

Maybe have a look at https://github.com/eyalroz/printf, if only for the test suite, which looks pretty comprehensive and still fails.

Maybe "key features" does not mean the same in all projects, making every project appear "unnecessarily bloated while missing key features" in every other context?


Nice. Comprehensive unit tests are indeed welcome. Even a simple test code that tests all features, flags combinations, etc, and outputs a log. It will make easy for anyone to run it and compare the logs.

I had a bug:

    u_printf( my_output_cb, NULL, "%d" NL, -42 );
prints:

--42

I may have found an explanation. In u_parse_format(), case 'i': calls u_itoa( value, buffer, 10, false ); which outputs minus sign.

Then if ( number ) does if ( sign ) { output_cb( '-', ctx ); chars_written++; } which outputs another minus sign.


Thanks, I will review your PR, and I have to thank you very much for saving my time and correcting the error.


Also floats seem to "forget" the integer part, and also have two minus signs when negative.



> visual programming

25 years ago when I read that Microsoft has a software development environment named "Visual Studio" I imagined, well, something with graphs and nodes and flow and... Well something visual, right? Now it's 2024 and VS is still not visual.

Of course things are not as simple. Flyde (along with many alternatives mentioned) is visual IMHO. Keep up the good work!


"Visual" in Visual Studio was a reference to RAD. Basically, visual form and report designers.


Thank you!


Excellent! A similar program, apparently from 3 years ago, did similar things, in Basic also, on the Amstrad CPC, a machine with the same processor, a little more RAM and more (27) colors or shades of green, depending on the screen it was hooked to.

* colored spheres (like you did)

* (one) checkerboard surface

* self-shadowing (like you did)

* cast shadows (like you did)

* partial or total specular reflection!

See https://www.cpc-power.com/index.php?page=detail&num=19283

The webpage displays the color (left) and green (right) versions on hovering your pointer over the ribbon (above). Image 1 and 2 are okay in both cases, image 3 is clearly tuned for color screen, image 4 for green screen.

Or direct links to the relevant variants:

https://www.cpc-power.com/extra_lire_fichier.php?extra=cpcol...

https://www.cpc-power.com/extra_lire_fichier.php?extra=cpcol...

https://www.cpc-power.com/extra_lire_fichier.php?extra=cpcol...

https://www.cpc-power.com/extra_lire_fichier.php?extra=cpcol...

https://www.cpc-power.com/extra_lire_fichier.php?extra=cpcol...

https://www.cpc-power.com/extra_lire_fichier.php?extra=cpcol...


That's pretty impressive. The main difficulty with reflections in the ZX Spectrum is not so much the limited color palette, which can be dealt with, but the 2-color limit per 8x8 block. It's already a big issue with just lights and shadows as it is :-/


> the 2-color limit per 8x8 block. It's already a big issue with just lights and shadows as it is :-/

Well, you impressed me (and others) with your simple bet that "hey, what if I simply choose the two most popular colors" and just code that in simple BASIC. The same could be done with the shading. It would probably pick a good compromise when bright yellow meets dark red: by choosing to have the few should-be-red pixels become yellow, you avoid a bigger obviously-square-grid-based clash of colors.

Next step: error diffusion dithering would IMHO be a good bet. But maybe that becomes really to much for Basic.

I've been considering doing Raytracing on the Amstrad CPC, but in C. Perhaps using integers only, for speed.

Done that instead: https://cpcitor.itch.io/just-get-9

Hey, found this https://bbcmic.ro/?t=9ctpk via "BBC BASIC raytracer in 432 characters (mastodon.me.uk)" https://news.ycombinator.com/item?id=39023056#39023768


You mean, like this? https://www.youtube.com/watch?v=SJ79CdUMfVA

Also, not exactly the same type or rendering, but basically word for word what you wrote: the full-screen fully animated parts appear to be "a set of frames rendered out and stitched together to make an animated sequence"

https://www.youtube.com/watch?v=o59LrpzGUaE


In my opinion, you're spot on: being deprived of hearing the lowest frequencies typically occurs only when there's a pressure imbalance between the inner and outer ear. Therefore, when you experience silence at these lowest frequencies due to noise cancelling, your brain may assume a pressure imbalance must be the cause.

I've had the opportunity to use a variety of noise cancelling headphones over the years, from various brands, both in-ear and over-ear, and they all had this effect.

The good news is that you can become completely accustomed to it: after a while, the brain understands that there's no pressure imbalance, and it becomes a non-issue. Not hearing low frequencies is exactly what we expect from the product.

The article goes further to discuss some slope in a graph around 500Hz, which might be true, but I don't subscribe to that. It seems unnecessary to explain the observed facts and adds nothing.

What is not addressed at all is why all models seem to emit a subtle continuous shhhhhhh across a broad range of high frequencies. It's so subtle that you can only notice it when the outside environment is already quiet. I've never been certain whether it's just noise from the signal processing. My intuition is that it's artificially added to prevent inducing tinnitus in some users.


IMHO this is the effect expected by the people who named the function, and the reason why the name is very well chosen.

Yes, it's funny but that's not the point. The important thing is that the name clearly conveys the message that you really shouldn't be calling it, as explained in the comments above the function definition.

The "funny but there's a real reason behind" aspect is a bit like https://xkcd.com/radiation/ : "It's for general education only. If you're basing radiation safety procedures on an internet PNG image and things go wrong, you have no one to blame but yourself." The sentence is funny but has a real purpose: protect readers and author.


* Context: const and compile-time constants

Constructs fully determined at compile time have some benefits. But const in C is weaker than constexpr that C++ has.

As prog-fh summarizes on https://stackoverflow.com/questions/66144082/why-does-gcc-cl...

> "The const means « I swear that I won't change the value of this variable » (or the compiler will remind me!). But it does not mean that it could not change by another mean I don't see in this compilation unit; thus this is not exactly a constant."

One example of invalid C:

const int mysize = 2; const int myarray[mysize];

gcc: error: variably modified ‘myarray’ at file scope

clang: warning: variable length array folded to constant array as an extension [-Wgnu-folding-constant] const int myarray[mysize];

* Good news: C can do compile time constant structs and array with deep self-references.

Yes, in C you can define and fully declare complex data structures that are accepted as compile-time constants, including pointers to parts of itself.

See "self-contained, statically allocated, totally const data structure with backward and forward references (pointers)?" for a previous example at https://stackoverflow.com/questions/47037701/can-c-syntax-de...

-----------------

I used this for a game on a retro machine where such a data structure avoids code which would have been several times (perhaps 10 times) bigger: https://github.com/cpcitor/color-flood-for-amstrad-cpc/blob/...

Here's another take showing two variants: where overall construct is an array then a struct: https://gist.github.com/fidergo-stephane-gourichon/792c194e1...


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

Search: