Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
ryao
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
39 ms
·
511.
▲
by
ryao
1y ago
Distribution build systems typically operate outside of an IDE. I suspect that it would be a nightmare to get 20,000 packages to compile in an IDE. It is possible in theory to write a compiler plugin to generate an error when code that does
512.
▲
by
ryao
1y ago
We can use UB to refer to both. :)
513.
▲
by
ryao
1y ago
Most of the C code I write is C99 code, so it is undefined behavior either way for me (if I care about compilers other than GCC and Clang). That said, I am going to defer to the GCC developers on this since I do not have time to make sense
514.
▲
by
ryao
1y ago
I see. Carry on then. :)
515.
▲
by
ryao
1y ago
According to another comment, the C standard contradicts the C standard on this: https://news.ycombinator.com/item?id=43794268 Taking snippets of the C standard out of context of the whole seems to result in misunderstandin
516.
▲
by
ryao
1y ago
It is an excerpt being taken out of context. Of course it is quite clear. Taking it out of context ignores everything else that the standard says. That interpretation is wrong as far as compiler authors are concerned.
517.
▲
by
ryao
1y ago
As a retired Gentoo developer, I can say not really as far as I know. There could be static analysis tools that can find this, but I am not aware of anyone who runs them on the entire distribution.
518.
▲
by
ryao
1y ago
If C++ had never been invented, that might have been the case.
519.
▲
by
ryao
1y ago
What is your point? I already said that GCC defines it even though the C standard does not. As per the GCC developers: > Type punning via unions is undefined behavior in both c and c++. https://gcc.gnu.org/bugzilla/s
520.
▲
by
ryao
1y ago
Here is what was said: > Type punning via unions is undefined behavior in both c and c++. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118141#c13 Feel free to start a discussion on the GCC mailing list.
521.
▲
by
ryao
1y ago
The GCC developers disagree as of last December: > Type punning via unions is undefined behavior in both c and c++. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118141#c13
522.
▲
by
ryao
1y ago
The GCC developers disagree with your interpretation: > Type punning via unions is undefined behavior in both c and c++. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118141#c13
523.
▲
by
ryao
1y ago
I said that GCC defines type punning via unions. It is an extension to the C standard that GCC did. That said, using “the code compiles in godbolt” as proof that it is not relying on what the standard specifies to be UB is fallacious.
524.
▲
by
ryao
1y ago
There is no footnote about it in the C standard. Someone proposed adding one to standardize the behavior, but it was never accepted. Ever since then, people keep quoting it even though it is a rejected amendment.
525.
▲
by
ryao
1y ago
There has been plenty of misinformation spread on that. One of the GCC developers told me explicitly that type punning through a union was UB in C, but defined by GCC when I asked (after I had a bug report closed due to UB). I could find th
526.
▲
by
ryao
1y ago
Well, under your original version, I could see someone filling in bit fields in the float like the exponent and sign while leaving the mantissa zeroed, but given that the integer and float would be the same length, there is no section that
527.
▲
by
ryao
1y ago
GCC’s developers have a strong insistence on standards conformance (minus situations where they explicitly choose to deviate, like type punning in unions) over the status quo. We already went through a much more severe shift with strict ali
528.
▲
by
ryao
1y ago
How would that be broken by this? The union will be zero initialized regardless because this change only affects situations where the union members are of different lengths, but for integer to float, the union members should always be the s
529.
▲
by
ryao
1y ago
GCC has long been known to define undefined behavior in C unions. In particular, type punning in unions is undefined behavior under the C and C++ standards, but GCC (and Clang) define it.
530.
▲
by
ryao
1y ago
Interestingly, they recently pushed ntsync into the Linux kernel specifically for use by wine.
531.
▲
by
ryao
1y ago
> This is going to silently break so much existing code How much code actually uses unions this way? > especially union based type punning in C code I have never done type punning via the GNU C compiler extension in a way that would
532.
▲
by
ryao
1y ago
I suspect this change was motivated by standards conformance.
533.
▲
by
ryao
1y ago
Am I the only person using tmux+vim+cscope+bash+gcc as a development environment? I do not see the need for these GUIs. I also can develop software from just about anywhere as I only need to SSH into a machine with these things (+git) insta
534.
▲
by
ryao
2y ago
No, since Windows is less efficient in general.
535.
▲
by
ryao
2y ago
I thought WSL1 implemented Linux's ABI in the NT kernel and uses a Linux userland. Wine reimplements the a Windows userland and emulates NT kernel services in userland. The two do not seem the same, although the intention of running Li
536.
▲
by
ryao
2y ago
If you can get the exact quotes, please send them to Computer Stupidities: http://rinkworks.com/stupid/ As an obligatory warning, if you have never seen Computer Stupidities previously, expect to lose a day reading it.
537.
▲
by
ryao
2y ago
That is user mode linux. Cooperative Linux is something else: https://en.wikipedia.org/wiki/Cooperative_Linux Interestingly, Wikipedia claims that User-mode Linux inspired Cooperative Linux.
538.
▲
by
ryao
2y ago
I doubt that, since telemetry slows things down and it has been found that software runs faster under WSL than native Windows. A quick search found this, which shows a substantial performance difference for the same thing between native Win
539.
▲
by
ryao
2y ago
What is Suze Linux? Did you mean Suse Linux? I would suggest dropping Linux from the description since this has nothing to do with the Linux kernel. Perhaps you could write POSIX instead.
540.
▲
by
ryao
2y ago
My mother has invoked it at various points in my life to try to motivate me to do the bare minimum to help myself when she did not think I was doing even that much (and was capable of doing it). I suppose that could have seemed like a cudge
More ›