Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
_kst_
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
51 ms
·
511.
▲
by
_kst_
11y ago
Fixing it in the shell wouldn't have worked. See my other comment.
512.
▲
by
_kst_
11y ago
Yes, that's the nasty gotcha that I hadn't though about!
513.
▲
by
_kst_
11y ago
It would make more sense for it to be handled by execve() or equivalent. For example, you need to be able to execute a file named "/bin/sh" -- but for that file to be executable under Windows, it needs to be named "
514.
▲
by
_kst_
11y ago
Enumeration constants have scope.
515.
▲
by
_kst_
11y ago
True, but only for type int. enum { MAX = 1000 };
516.
▲
by
_kst_
11y ago
> #ifdefs don't protect you from misspelled words, #ifs do. That's not (typically) correct. If an undefined identifier is used in a preprocessor expression, it expands (contracts?) to a constant 0. gcc does not warn about using
517.
▲
by
_kst_
11y ago
The name of a variable, global or otherwise, is not a constant expression, so there are contexts in which it can't be used.
518.
▲
by
_kst_
11y ago
I wouldn't call that "C-style code". Namespaces are a C++-specific feature, and inline namespaces were introduced in C++-11. C has never had either feature.
519.
▲
by
_kst_
11y ago
The home page is http://peach.cool/ It looks like the app is available only for iOS. It's a pity that the article doesn't mention either of those things.
520.
▲
by
_kst_
11y ago
The `PRIuMAX` macro in particular is not necessary. It expands to a format usable for `uintmax_t`, but you can also use `"%ju"`. Both were introduced in ISO C99. (Unless your `printf` implementation doesn't recognize `"
521.
▲
by
_kst_
11y ago
The `PRIuMAX` et al macros are specified by ISO C (starting with the 1999 standard), not (just) by POSIX.
522.
▲
by
_kst_
11y ago
Because the 1999 and 2011 standards added some useful features. Unfortunately, there are still some compilers that don't support C99.
523.
▲
by
_kst_
11y ago
> There is no way to recover from a failed VLA allocation. There's no way to recover from any stack allocation. #define TOO_BIG 1000000 This: { double big_array[TOO_BIG]; // not a VLA } is n
524.
▲
by
_kst_
11y ago
And it's wrong for yet another reason. You can convert a pointer to uintprt_t, but arithmetic on the result isn't necessarily meaningful.
525.
▲
by
_kst_
11y ago
You're right, using uintptr_t for pointer arithmetic is a bad idea. I've worked on systems (Cray vector machines) where converting a pointer to an integer type, performing arithmetic on the integer, and converting back to a pointe
526.
▲
by
_kst_
11y ago
If you want to access a buffer as raw bytes (which may or may not be octets), use `unsigned char`. Plain `char` may be either signed or unsigned, depending on the implementation.
527.
▲
by
_kst_
11y ago
Is all-bits-zero really "safe"? Sure, sometimes it is, but the safest approach is ensure that you've assigned a valid value to any object before you access that value. If you fail to do that, pre-zeroing might just give you
528.
▲
by
_kst_
11y ago
The object is merely in the direction of the Alpha Centauri system. If it's in that system, given its brightness, it would probably be a red dwarf, and we would have found it years ago. Assuming it's not just an imaging glitch,
529.
▲
by
_kst_
11y ago
"Undefined behavior" means behavior that is not defined by the C standard. Things other than the C standard (secondary standards like POSIX, compiler documentation, hardware specifications, etc.) are free to define the behavior of
530.
▲
by
_kst_
11y ago
That's inaccurate, according to the page you linked to (and to my memory of the incident). gcc 1.17 would invoke nethack (or one of several other similar games, if available) if it saw an unrecogized #pragma directive. According to the
531.
▲
by
_kst_
11y ago
I get "Cannot call method 'slice' of undefined" when I open the link.
532.
▲
by
_kst_
11y ago
The C standard doesn't exactly "inherit" the 170 pages of the C language spec. As far as I know, the core C++ language (excluding the library) is defined entirely by the C++ standard, without reference to the C standard. It w
533.
▲
by
_kst_
11y ago
I think you mean CVS, not CSV.
534.
▲
by
_kst_
11y ago
It's been said (I don't know how accurately) that some people do use 100% of their brains. They just happen to be in the midst of a grand mal epileptic seizure.
535.
▲
by
_kst_
11y ago
You could randomize them subject to the constraint that you never have two blanks in a row. That probably would have been the responsibility of the person who loads the bottles into the machine. Even so, I agree that it's an impressive
536.
▲
by
_kst_
11y ago
Can you format the quotations as quotations (leading "> ", I think) rather than indenting them? As it is, you have to scroll right to read the entire quotation.
537.
▲
by
_kst_
11y ago
An interesting article that would be improved by removing the references to "gnu atheism" and "scientism".
538.
▲
by
_kst_
11y ago
I just copied a couple of files there. In the browser window where I copied them, it correctly showed the sizes as 8 kbytes and 63 kbytes. When I re-open the same page, it shows them as "8 bytes" and "63 bytes". They dow
539.
▲
by
_kst_
11y ago
The link is to an image of the front cover of K&R2 (Kernighan & Ritchie, "The C Programming Language", 2nd edition). You probably meant the image to show up in your comment, but it didn't.
540.
▲
by
_kst_
11y ago
The second link is now giving me "yubico site under maintenance". Same for https://yubico.com/
More ›