Readit News logoReadit News
fay59 commented on Lesser known tricks, quirks and features of C   blog.joren.ga/less-known-... · Posted by u/jandeboevrie
layer8 · 3 years ago
One reason is locale-dependent format strings which are loaded from resource files.

Also, in personal projects, I almost always used custom wrapper functions for printf/fprintf/sprintf for various reasons, so that default wouldn’t be of much use, unless maybe I could enable it for the custom functions.

fay59 · 3 years ago
The former is ideally resolved with attribute((format_arg)), the latter with attribute((format)).
fay59 commented on Lesser known tricks, quirks and features of C   blog.joren.ga/less-known-... · Posted by u/jandeboevrie
wrigby · 3 years ago
Thanks! This prompted me to look up the flag to enable this. For GCC it’s:

  -Werror=format-security

fay59 · 3 years ago
The flag is -Wformat-nonliteral or -Wformat=2. -Wformat-security only includes a weaker variant that will warn if you pass a variable and no arguments to printf.
fay59 commented on Apple offers $970 in trade-in value for $52,199 Mac Pro   twitter.com/durvidimel/st... · Posted by u/frankjr
euph0ria · 3 years ago
Something that surprised me was that my MacBook that is pristine but 5 years old do not get any more OS updates.. and therefore no latest Xcode.. and therefore worthless to me. Are all iOS/Mac devs buying new machines every five years?
fay59 · 3 years ago
5 years seems like a low for Apple device longevity. I think that there’s an enormous difference between today’s Macs and Macs from 5 years ago and maybe the leap is accelerate deprecation, but there was a long period of stagnating macOS requirements. Hope we return to that for Apple Silicon Macs.
fay59 commented on Figuring out round, floor and ceil with integer division   blog.pkh.me/p/36-figuring... · Posted by u/ux
fay59 · 3 years ago
> We could stop right here but this suffers from overflow limitations if translated into C.

FWIW, the final version also suffers from integer overflow limitations. If the difference between an and INT_MIN/INT_MAX (depending on whether you floor or ceil) is <= b/2, you will have integer overflow.

fay59 commented on Computer proof ‘blows up’ centuries-old fluid equations   quantamagazine.org/comput... · Posted by u/nsoonhui
somat · 3 years ago
"That’s because it’s impossible for a computer to calculate infinite values. It can get very close to seeing a singularity, but it can’t actually reach it"

Why not?

Is it impossible to calculate infinite values in general? I suspect not, My understanding is that a lot of calculus is in fact on how to calculate infinite values.

And a computer is a universal machine, this means that while it can not calculate everything, it can calculate anything that is calculable.

fay59 · 3 years ago
In context, it sounds like they relied on simulations that don’t use exact numbers. I’m guessing that they saw an IEEE-754 floating-point infinity and then had to determine whether they got it because the accurate result was infinity or if the infinity they saw was the result of floating-point calculation artifacts.
fay59 commented on Nearly all binary searches and mergesorts are broken (2006)   ai.googleblog.com/2006/06... · Posted by u/finnlab
GuB-42 · 3 years ago
It is unfortunate that the language doesn't have a built-in "average between two ints" function. It is a common operation, people often get it wrong, as shown by this article, and it may have a really simple and correct assembly representation that the compiler may take advantage of.

Such a function, even if it seems trivial, has some educative value as it opens an opportunity to explain the problem in the documentation.

fay59 · 3 years ago
I feel that it’s so simple that many people will overlook that it even exists. In languages that have both, it’s hard for functions to compete with operators. I don’t think that this is the best design to promote correctness.
fay59 commented on Chess is just poker now   theatlantic.com/technolog... · Posted by u/imartin2k
fay59 · 3 years ago
The “battle of preparedness” for grandmasters looks miserable. My experience being bad at chess is pretty cool, though.

If anyone’s looking to pick up chess, it’s a pretty good time to do it even if the people making a living out if it aren’t enjoying it anymore. It used to be that computers would only crush you without helping, but now they’re able to point at your mistakes and show you where the game shifted from one player to the other.

fay59 commented on Android 13 requires devices to have more than 2GB RAM and 16GB storage   android-developers.google... · Posted by u/teleforce
greggman3 · 3 years ago
It's kind of insane to me that my phone (Android or iOS) requires 2GB of ram and 16GB of storage given that in 1995 my WindowsNT 4.0 PC with 128Meg of ram and maybe 2gb HD ran 3DStudio Max to render 3D effects and movies and and ran Photoshop and MS Office (Word/Excel/Powerpoint) and now it takes 2GB to just write messages, and share photos :P
fay59 · 3 years ago
Yes, but your 1995 Windows NT 4.0 PC ran a 640x480 display at 60Hz and graphics compositing had, at best, one-bit transparency. It took 3 minutes to boot. Websites could bluescreen it with `<img src="con">`. A malicious attachment could trick your email client into deleting your whole hard drive.
fay59 commented on After self-hosting my email for twenty-three years I have thrown in the towel   cfenollosa.com/blog/after... · Posted by u/carlesfe
fay59 · 3 years ago
How does one verify that their server has never ever sent spam, for instance through a security breach?
fay59 commented on Xz format considered inadequate for long-term archiving (2016)   nongnu.org/lzip/xz_inadeq... · Posted by u/goranmoomin
fay59 · 3 years ago
This is fairly old. When it came up last time, there were robust arguments that xz was characterized unfairly, and that the author’s format wasn’t very good at recovering in most cases either.

u/fay59

KarmaCake day259June 23, 2020View Original