Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
flatfinger
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
9 ms
·
31.
▲
by
flatfinger
6y ago
> Although I do disagree that writing a signed value is useful Although the Standard defines the behavior of signed-to-unsigned conversion in a way that would yield the same bit pattern as a two's-complement signed number, some comp
32.
▲
by
flatfinger
6y ago
> It should be obvious to compiler writers what the intention of the standard is, because it says so in the dang text, but since this was downgraded to a note and you are technically not in violation if you do something different, everyo
33.
▲
by
flatfinger
6y ago
The difference between "Undefined behavior", as the term is used in the Standard, and "Implementation-Defined Behavior", is that implementations are required to document at least some kind of guarantee about the behavior
34.
▲
by
flatfinger
6y ago
The amount of effort for a compiler to process optimally all 72 variations of "read/write a signed/unsigned 2/4/8-byte big/little-endian value from an address that is aligned on a 1/2/4/8-byte bo
35.
▲
by
flatfinger
6y ago
Is the present purpose of the Standard to: 1. define a highly-extensible abstraction model, which implementations intended for various purposes should be expected to extend to suit those purpose, or 2. define an abstraction model which is s
36.
▲
by
flatfinger
6y ago
What is really missing from the C "aliasing" rules is a recognition that an access to a pointer/lvalue which is visibly freshly derived from another is, depending upon the form of derivation, either a definite or potential ac
37.
▲
by
flatfinger
6y ago
I wouldn't mind traps on overflow, though I think overflow reporting with somewhat loose semantics that would allow an implementation to produce arithmetically correct results when convenient, and give a compiler flexibility as to when
38.
▲
by
flatfinger
6y ago
I can certainly understand the value in allowing compilers to perform integer arithmetic using larger types than specified, at their leisure, or behave as though they do. Such allowance permits `x+y > y` to be replaced with `x > 0`,
39.
▲
by
flatfinger
6y ago
The problem is that under modern interpretation, even if some parts of the Standard and a platform's documentation would define the behavior of some action, the fact that some part of the Standard would regards an overlapping category
40.
▲
by
flatfinger
6y ago
Consider the following function: int test(int a, int b) { int c = a/b; if (f1()) f2(a,b,c); } Should a compiler be required to compute c before calling f1, and thus have to store the value of c acro
41.
▲
by
flatfinger
6y ago
Where does that myth come from!? According to the authors of C89 and C99, Undefined Behavior was intended to, among other things, "identify areas of conforming language extension" [their words]. Code which relies upon UB may be
42.
▲
by
flatfinger
6y ago
The semantics most programs need for overflow are to ensure that (1) overflow does not have intolerable side effects beyond yielding a likely-meaningless value, and (2) some programs may need to know whether an overflow might have produced
43.
▲
by
flatfinger
6y ago
Having a program behave in unreliably uselessly unpredictable fashion can only be tolerable in cases where nothing the program would be capable of doing would be intolerable. Such situations exist, but they are rare. Otherwise, the questio
44.
▲
by
flatfinger
6y ago
Such attributes would be most useful if the semantics were that any time after a program receives inputs that would cause a "pure" function to be called with certain arguments, a compiler may at its leisure call the function with
45.
▲
by
flatfinger
6y ago
Many programs are subject to two constraints: 1. Behave usefully when practical, if given valid data. 2. Do not behave intolerably, even when given maliciously crafted data. For a program to be considered usable, point #1 may be sometimes b
46.
▲
by
flatfinger
6y ago
How about having an attribute which, if applied to a structure that contains a `T*` and an integer type, would allow a `T[]` to be implicitly converted to that structure type?
47.
▲
by
flatfinger
6y ago
Most of the useful optimizations that could be facilitated by treating integer overflow as jump the rails optimization could be facilitated just as well by allowing implementations to behave as though integers may sometimes, non-determinist
48.
▲
by
flatfinger
6y ago
The fact that the Standard does not impose requirements upon how a piece of code behaves implies that the code is not strictly conforming, but the notion that it is "invalid" runs directly contrary to the intentions of the C89 and
49.
▲
by
flatfinger
6y ago
Rather than trying to decide whether to require that all implementations must use two's-complement math, or suggest that all programs should support unusual formats, the Standard should recognize some categories of implementations with
50.
▲
by
flatfinger
6y ago
Different implementations are used for different purposes. If 20% of implementations are used for purposes where a feature would be useful, which of the following would be best: 1. Have 10% of implementations support the feature one way,