Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
teo_zero
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
22 ms
·
391.
▲
by
teo_zero
2y ago
> you can use a pointer to str_buf anywhere a function calls for a pointer to str Yes, you could , but I see no function mentioned in TFA that wants a pointer to str, only functions that want a str: print_str(), print_fmt(), com_write()
392.
▲
by
teo_zero
2y ago
Good attempt at a topic that annoys many programmers. I see a problem with the separation between str and str_buf, though: you create new strings with the latter, but most functions take the former as arguments. Do you convert them every ti
393.
▲
by
teo_zero
2y ago
> C compilers can change even the O complexity of your algorithms I'd be curious to see an example...
394.
▲
by
teo_zero
2y ago
You are conflating 2 concepts: a) that the reality converges to what the theory predicts only after a great number of samples; b) that if you skip some events the results will vary. Now, b) is false. You can change the code to extract 3 ran
395.
▲
by
teo_zero
2y ago
> Sorting costs some time, but in return, removes cache misses from the for loop entirely. Mmm. Can someone explain this? To avoid n cache misses in the for loop, we accept nlog(n) cache misses for sorting?
396.
▲
by
teo_zero
2y ago
I find this article particularly hard to read. The author states: > I’m using Python as pseudocode; pretend I used your favorite low-level language) But then the code is full of Pythonic constructs alien to any other low-level language (
397.
▲
by
teo_zero
2y ago
While I don't agree on nearly anything you stated, I enjoyed your prose: I suppose you left out words here and there as a metaphorical proof of your claim that you can't miss a single toss, didn't you?
398.
▲
by
teo_zero
2y ago
No need for Ctrl: imagine simply mapping p to v and P to V.
399.
▲
by
teo_zero
2y ago
I think the parent poster meant that two newlines in file are displayed as an empty line. That's ok. What's odd is that the cursor is allowed to stay in the empty line, as if it was on a virtual character at the end of the line. H
400.
▲
by
teo_zero
2y ago
The point is that they teach you that 'i' enters insert mode and '<esc>' exits it. This is not true! It it was true and 'i' and '<esc>' only switched mode, then the sequence 'i<esc
401.
▲
by
teo_zero
2y ago
I wonder why every attempt at copying vi's concept, which is reasonable, also ends up copying its keybinding from the 70s. I'm not talking about hjkl, but rather y for yank, p for put, d for delete, u for undo... where today ever
402.
▲
by
teo_zero
2y ago
> So if I understand it This is not what TFA says at all. Especially this one: > Fourth you must bet big. is explicitly listed as a common mistake all the involved students exhibited.
403.
▲
by
teo_zero
2y ago
> [0-based indexes] are a relic of C style arrays I don't think this is true. They exist in other disciplines (maths for instance) that have no relationship with C or other programming languages from the 1970s. > for 0 to count&#
404.
▲
by
teo_zero
2y ago
> C doesn't have any problems adding 4 to NULL nor subtracting NULL from NULL. "Having problems" is not a fair description of what's at stake here. The C standard simply says that it doesn't guarantee that such o
405.
▲
by
teo_zero
2y ago
But in this specific implementation the keys are stored separately, each one at its own malloc()ed address. So its performance is limited by memory latency, cache (non-)locality, etc. just like the chained-lists variety.
406.
▲
by
teo_zero
2y ago
Right. Thinking about it, I don't grasp why the author has opted for linear probing here. Given the amount of malloc(), they might have used linked lists as well.
407.
▲
by
teo_zero
2y ago
Right. It would be nice if C allowed types and variables to be separated, we could even defines arrays like this: char[8] buffer; Alas, it's not the syntax Dennis Ritchie settled upon.
408.
▲
by
teo_zero
2y ago
Row 100 of hm_put() clears all contents of the item struct, thus losing the pointer to where the previous value was stored. But then row 107 needs this pointer to pass it to realloc(). Additionally, in case of overwrite, the memory previous
409.
▲
by
teo_zero
2y ago
Everything you can do in inputrc can be done in bashrc if you prepend "bind". In this case: bind 'set enable-bracketed-paste on'
410.
▲
by
teo_zero
2y ago
Wouldn't this require make to run CC with -MD on each instance of ! every time it's invoked, just to collect the list of dependencies, maybe just to discover that no file has changed?
411.
▲
by
teo_zero
2y ago
Surprisingly, the sizeof operator applies to prefix expressions, too, except casting. So sizeof !x works, but sizeof (int)x doesn't, despite ! and casting having the same precedence. The presence of (int) sort of promotes sizeof from &
412.
▲
by
teo_zero
2y ago
Curious how the author first spends words to explain that concatenating strings can be wasteful of precious memory, and then does exactly that in the program, by repeatedly printing constructed strings (with "+") instead of merely
413.
▲
by
teo_zero
2y ago
Shareware software come with restrictions on redistribution , not use .
414.
▲
by
teo_zero
2y ago
Nice job! But why 3 steps of compilation? The first step merely shows that you wrote valid C code that gcc can compile. It doesn't prove that the program actually does what promised. For example, if you missed to implement 'for&#x
415.
▲
by
teo_zero
2y ago
Does it work with non-English dates?
416.
▲
by
teo_zero
2y ago
Something sounds odd. If points are very close, they have high spacial frequency. If I reject points that are too close, I'm excluding high-frequency points and keeping only low-frequency ones. A distribution that favor lower frequenci
417.
▲
by
teo_zero
2y ago
> if angry is the right emotion Of course it's not, haven’t you noticed they said "irrationally"?
418.
▲
by
teo_zero
2y ago
> The only way to win is to reverse the random number generator used to create the contest file In that case Mike, the contest creator, may declare the result invalid because you haven't satisfied the intent of the challenge.
419.
▲
by
teo_zero
2y ago
I'd say it's more like wearing a life jacket while building and testing a ship, but not imposing to every passenger to wear one once the ship is certified and put in service.
420.
▲
by
teo_zero
2y ago
What C compiler would add bounds checks?
More ›