Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
_kst_
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
14 ms
·
151.
▲
by
_kst_
5y ago
Are they really? 8-)}
152.
▲
by
_kst_
5y ago
This "fix" also made it impossible to represent times before 1970. Admittedly that's probably a rare problem, but I can imagine it could have broken something (An interesting tidbit: Since 2018-07-22, a 32-bit signed time_t w
153.
▲
by
_kst_
5y ago
In typical US usage, we have (parentheses), [brackets], and {braces}, but the terms vary regionally in confusing ways. I think the word "parentheses" is unambiguous, but using the terms "square brackets" and "curly
154.
▲
by
_kst_
5y ago
It depends on how you define "democracy". I'm not inclined to participate in an argument about it here, but there are valid points of view other than the one you assert.
155.
▲
by
_kst_
5y ago
And if "file" is the name of an existing directory, it creates an empty file called "file/null". "touch" exists for a reason.
156.
▲
by
_kst_
5y ago
Better: for f in *.png; do convert "$f" "${f/%.png/.webp}" ; done Quoting the arguments lets it correctly handle file names with funny characters, including spaces. Using the `${parameter/pattern&
157.
▲
by
_kst_
5y ago
I'm using a Windows laptop with an external USB keyboard. The Shift key didn't do anything. But the Shift key on the laptop's own keyboard worked.
158.
▲
by
_kst_
5y ago
I'm reasonably sure that "fair use" doesn't mean what you think it means.
159.
▲
by
_kst_
5y ago
Isn't that still under copyright?
160.
▲
by
_kst_
5y ago
Does "previous corona infections" refer to previous Covid-19 infections, or previous infections by other corona viruses?
161.
▲
by
_kst_
5y ago
> The author of this document proposes restricting user-defined exit codes to the range 64 - 113 (in addition to 0, for success), to conform with the C/C++ standard. The C and C++ standards don't say anything that suggests rese
162.
▲
by
_kst_
5y ago
One issue with that is that using 1 for success conflicts with the nearly universal Unix convention of using 0 for success. C requires exit(0) to indicate a successful status. The OpenVMS C library translates that to a status of 1. A lot of
163.
▲
by
_kst_
5y ago
Without commenting on what Debian should do about this, I've pretty much given up using `which` myself. Since `which` is an external command (it's built into some shells, but not bash), it doesn't know about aliases, shell fu
164.
▲
by
_kst_
5y ago
No, it's not undefined behavior. Only the status returned to the host environment is undefined. (And in C99 and later, the status is 0.) As for your example: int foo(int x) { if (x >= 0) return 123; if (x < 0) return 456; } that
165.
▲
by
_kst_
5y ago
Any such expectation is unfounded. The C90 standard says: "A return from the initial call to the main function is equivalent to calling the exit function with the value returned by the main function as its argument. If the main functi
166.
▲
by
_kst_
5y ago
Yes, it's inaccurate. Here's what the C90 standard says: 5.1.2.2.3 Program termination A return from the initial call to the main function is equivalent to calling the exit function with the value returned by the main function as
167.
▲
by
_kst_
5y ago
Earlier versions of gcc didn't support C99 or later at all. Making reaching the closing "}" do an implicit "return 0;" was a new language feature, and it was tied to the (non-default) "-std=c9x" or later &
168.
▲
by
_kst_
5y ago
Random number generation generally isn't handled by system calls. It's just computation. (Some languages do provide support for hardware [pseudo-]random number generation. C doesn't.) More generally, using system calls direct
169.
▲
by
_kst_
5y ago
For me, it doesn't matter whether printf("hello\n") works via a call to printf or a call to puts. If those 6 characters I specified are written to standard output, I don't care how it was done. Of course I care if I want
170.
▲
by
_kst_
5y ago
There is no "undefined behavior" in the sense that the C standard uses that term. The choice of which function to generate a call to in the generated assembly or machine code is not "behavior". The way I think of it is t
171.
▲
by
_kst_
5y ago
No, it's not undefined behavior. An aside: "ANSI C" usually refers to the C language as defined by the last standard directly published by ANSI, in 1989 -- but the ANSI organization has adopted each new ISO C standard after p
172.
▲
by
_kst_
5y ago
The old behavior is not undefined behavior . In C90, falling off the end of main() returns an undefined status to the environment. The behavior of the program is otherwise well defined. It's true that an implementation that follows th
173.
▲
by
_kst_
5y ago
"Pop quiz! What will the following program return? int main() { printf("Hello World!\n"); } In C99 or later, it produces a mandatory diagnostic because `printf` is not declared. In C90, it h
174.
▲
by
_kst_
5y ago
Why is that a problem? (That's a serious question. I'm not suggesting that it isn't a problem. Apparently it is for you.) If I write printf("Hello, world\n"), all I care about is that those characters are written to
175.
▲
by
_kst_
5y ago
The correct implementation is to return any non-negative int value you like.
176.
▲
by
_kst_
5y ago
Regardless of how you think a modern compiler in C99 mode should behave, the fact is that "gcc -std=c90" generates code that returns an arbitrary value from main if no return or exit is executed. clang doesn't do this as fa
177.
▲
by
_kst_
5y ago
That particular implementation probably returns the result of the last fputc() or equivalent that it called. puts() returns EOF (typically -1) on error, or some unspecified non-negative value on success. fputc() returns EOF on error or the
178.
▲
by
_kst_
5y ago
Assuming that Facebook forced the account to be deleted, it wouldn't have been done by anyone who's working on fixing the problem.
179.
▲
by
_kst_
5y ago
IMHO the more interesting oddity about the functions declared in <ctype.h> is that they work with unsigned char, which means that they have undefined behavior if you pass a negative char value (other than EOF, which is typically -1).
180.
▲
by
_kst_
5y ago
isalpha() works with the "C" locale unless you first call setlocale(). For example, on my system isalpha(0xe7) is true if I first call setlocale(LC_ALL, "en_US.iso88591").
More ›