Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
jmillikin
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
7 ms
·
31.
▲
by
jmillikin
1y ago
You wrote "water has great compressive strength", sk5t directly (and correctly) refuted that claim. What is there to think about? Are you confusing "compressive strength" with compressibility?
32.
▲
by
jmillikin
2y ago
> use SECCOMP_SET_MODE_STRICT to isolate the child process. But at that > point, what are you even doing? Probably nothing useful. The classic example of a fully-seccomp'd subprocess is decoding / decompression. If
33.
▲
Rust Any part 3: we have upcasts
(lucumr.pocoo.org)
174 points
by
jmillikin
2y ago
|
76 comments
34.
▲
PeanoScript: TypeScript but It's a Theorem Prover
(peanoscript.mjgrzymek.com)
1 points
by
jmillikin
2y ago
|
0 comments
35.
▲
by
jmillikin
2y ago
I flagged this for being LLM-generated garbage; original comment below. Any readers interested in benchmarking programming language implementations should visit https://benchmarksgame-team.pages.debian.net/benchmarksgame
36.
▲
by
jmillikin
2y ago
The "dsb nsh; isb" sequence after "svc 0" is part of OpenBSD's mitigations for Spectre. https://github.com/openbsd/src/commit/bbeaada4689520859307d5... https://github.com&#
37.
▲
by
jmillikin
2y ago
`a = num; a += 1; if (num < a)` is the same as `if (num < (num + 1))`, which for unsigned integer addition can be rewritten as `if (num != UINT_MAX)`. So there's no need to actually compute `a+1`, the comparison is against a cons
38.
▲
by
jmillikin
2y ago
I was being somewhat terse. The (implied) claim is that the C standard has enough sources of undefined behavior that even a simple integer addition can't be relied upon to actually perform integer addition. But the sources of undefined
39.
▲
by
jmillikin
2y ago
> It is very straightforward indeed, but it is still not mapping primitive > operations to direct machine code, but it is forwarding to out-of-line code. > Same as operator overloading in other languages. I am not claim
40.
▲
by
jmillikin
2y ago
To reiterate, claiming that C can be described as "portable assembly" is not a claim that it is literally a package of assembler macros that emit deterministic machine code for each individual source expression. I linked these in
41.
▲
by
jmillikin
2y ago
All of those look pretty straightforward to me -- again, what assembly would you expect to be emitted in those cases? For contrast, here's the assembly generated for Haskell for integer addition: https://godbolt.org/z&#
42.
▲
by
jmillikin
2y ago
Take a closer look at 'eru's example and my follow-up. He wrote an example where the result of `a+1` isn't necessary, so the compiler doesn't emit an ADDI even though the literal text of the C source contains the substri
43.
▲
by
jmillikin
2y ago
I'm not sure that's a counter-example -- what assembly do you think should be emitted for floating-point math on an AVR microcontroller?
44.
▲
by
jmillikin
2y ago
For context, I did not pick that type signature at random. It was in actual code that was shipping to customers. If I remember correctly there was some sort of bool -> int -> char -> std::string path via `operator()` conversions an
45.
▲
by
jmillikin
2y ago
As a general rule if you're reading a technical discussion and every single participant is using a particular phrase in a way that doesn't make sense to you then you should probably do a quick double-check to make sure you're
46.
▲
by
jmillikin
2y ago
I don't think "dead-code elimination removes dead code" adds much to the discussion. If you change the code so that the value of `a` is used, then the output is as expected: https://godbolt.org/z/78eYx37W
47.
▲
by
jmillikin
2y ago
'eru implied `a += 1` has undefined behavior; I provided a trivial counter-example. If you'd like longer examples of C code that performs unsigned integer addition then the internet has many on offer. I'm not claiming that C
48.
▲
by
jmillikin
2y ago
From a high-level academic view, yes, the compiler is allowed to perform any legal transformation. But in practice C compilers are pretty conservative about what they emit, especially when code is compiled without -march= . You don't h
49.
▲
by
jmillikin
2y ago
I'll expand my point to be clearer. In C there is no operator overloading, so an expression like `a += 1` is easy to understand as incrementing a numeric value by 1, where that value's type is one of a small set of built-in types.
50.
▲
by
jmillikin
2y ago
Show me a C compiler that miscompiles the following code and I'll concede the point: uint32_t add_1(uint32_t a) { a += 1; return a; }
51.
▲
by
jmillikin
2y ago
> This is a very good example of how C is not "close to the machine" or > "portable assembly", C is very much "portable assembly" from the perspective of other systems programming languages of t
52.
▲
by
jmillikin
2y ago
Biggest category of libraries that need inline assembly with compiler portability are compression/decompression codecs (like the linked article) -- think of images (PNG, JPEG), audio (MP3, Opus, FLAC), video (MPEG4, H.264, AV1). Also i
53.
▲
by
jmillikin
2y ago
This sentence from the Reference is important: > The exact assembly code syntax is target-specific and opaque to the compiler > except for the way operands are substituted into the template string to form > the code passed
54.
▲
by
jmillikin
2y ago
> I’m all for multiple backends but there should be only 1 frontend. That’s > why I hope gccrs remains forever a research project - it’s useful to help > the Rust language people find holes in the spec but if it ever escap
55.
▲
by
jmillikin
2y ago
Note that becoming an international standard (via ISO, ECMA, IETF, or whatever) isn't necessary or sufficient to avoid dialects. If the Rust language specification is precise enough to avoid disagreements about intended behavior, the
56.
▲
by
jmillikin
2y ago
The quoted statement is weaker than what you're reading it as, I think. It's not a statement that emitted assembly code is guaranteed to conform to LLVM syntax, it's just noting that (1) at present, (2) for supported targets
57.
▲
by
jmillikin
2y ago
You're talking about the syntax of the assembly code itself. In practice small variations between assemblers isn't much of a problem for inline assembly in the same way it would be for standalone .s sources, because inline assembl
58.
▲
by
jmillikin
2y ago
Rust's inline assembly syntax is part of the language, and in principle the same Rust source would compile on any conforming compiler (rustc, gccrs). C/C++ doesn't have a standard syntax for inline assembly. Clang and GCC hav
59.
▲
by
jmillikin
2y ago
The JVM was designed with the intention of being a secure sandbox, and a lot of its early adoption was as Java applets that ran untrusted code in a browser context. It was a serious attempt by smart people to achieve a goal very similar to
60.
▲
by
jmillikin
2y ago
> The extent of how each bytecode was used doesn't invalidate their existence. It does, because uptake is the proof of suitability to purpose. There's no credit to just being first to think of an idea, only in being fir
More ›