47 karma · joined Feb 22, 2018 (8y ago) · 34 submissions
comment 8y ago · link · parent
Syntactic constructs in general should and do have meaning. The meaning isn’t inherent, but nothing has inherent meaning. log(x) has no inherent meaning, but when x is positive we have decided that it means that it evaluates to the value to which you would raise 10 to get x.
Bad run-time values only cause UB in the context of improper usage in syntactic constructs. They aren’t independent of syntactic constructs: both syntactic constructs and values dictate behavior.
You’re right that UB only manifests itself at run-time. And you’re right that we wouldn’t need to use UB for constructs that only manifest their behavior at compile-time. Indeed, there exists syntactically valid yet meaningless C++ template substitutions that don’t result in UB, they result in compilation errors.
comment 8y ago · link · parent
In the context of real numbers sqrt(-1) is syntactically valid yet meaningless code. In other contexts, 1 << -3 is too. Also log(-1). Perfectly valid syntax but has no meaning.
The intent of scare-quotes tends to be ambiguous so I avoid them in discussion. http://frivolousquotationmarks.tumblr.com
comment 8y ago · link · parent
Doing something at runtime is a different concept from having a runtime.
In any case, C, in fact, often does have a runtime. What do you think executes main()?
comment 8y ago · link · parent
Shifting by a negative number is meaningless and is indicative of programming error. Instead of specifying that an implementation should check and handle these programming errors, which implies runtime costs, we use undefined behavior and leave the responsibility to the programmer.
The reason many compilers assume a positive shift after a shift operation executes is because otherwise the entire program would be undefined. You’re effectively asking for undefined programs to have defined behavior. The equivalent would be asking the compiler to correct your typos and it can’t do that. As they say: garbage in, garbage out. The compiler isn’t the one booby trapping you, you’re booby trapping yourself.
I think GP is right that what you want is more definition but it has to be in specific cases because otherwise the runtime costs would be too high. In your negative shift example, the definition would be “shifting by a negative number results in garbage output,” but note that that would burden implementations where negative shifts trap.
comment 8y ago · link · parent
comment 8y ago · link · parent
The 2nd amendment is a principle, not a law. It’s a universal, in time and space, foundation upon which we base our laws. The Founders were well aware of this and it actually was their intention.
These were highly educated enlightenment thinkers, to assume they didn’t foresee weapon innovation is just silly.
comment 8y ago · link · parent
Threatening violence or slander has nothing to do with the first amendment.
comment 8y ago · link · parent
Projectile weapons have been improving throughout history, it’s silly to assume the Founders weren’t well aware of that. I mean, there were medieval weapons that were pretty devastating by even today’s standards and the first amendment makes no mention of that. These were enlightenment thinkers well versed in the history of governments and technological progress.
The 2nd amendment is a principle meant to transcend all time and cultures. The people have a fundamental right to defend their rights.
comment 8y ago · link · parent
The first amendment says nothing about “fake” or “real” news even though there was plenty of fake news in those days. I could argue fake news started the French Revolution.
comment 8y ago · link · parent
Free speech is the ability to express any opinion or idea, anti-government opinions included. This is why online posts and various non-verbal actions (like burning a flag) are protected under The First Amendment, even though nothing is being physically said. Additionally this is why threatening violence towards somebody isn’t protected: a threat of violence isn’t an opinion or an idea.
comment 8y ago · link · parent
comment 8y ago · link · parent
Another problem is where you make the compromise in the no-mans land between fully fledged data structure and file system. As soon as you start adding meaningful metadata to the file system, it quickly becomes apparent that you want the files themselves to be structured data and not just opaque sequences of bytes. At that point you’re redesigning the OS since that mode of usage requires user and application buy-in. It’s just a tough design problem to make any universally applicable progress in this space and it seems like any sort of non-HFS system is destined for application specific use cases.
comment 8y ago · link · parent
comment 8y ago · link · parent
Furthermore, even though T(n) is bounded by a constant, it is not constant itself and its runtime is proportional to the amount of prefix characters the input has in common with the secret. This makes it not “constant time” in the crypto sense and it is susceptible to timing attacks.
The existence of a function that is constant time in the O(1) sense but not in the crypto sense proves that they are distinct concepts.
comment 8y ago · link · parent
def matches_secret(a):
return a == “secret”
The execution time of matches_secret is bounded by a constant and the variation in execution time is correlated with secret information. This precisely means that matches_secret is constant time in the O(1) sense and not in the security sense referenced by the original article.comment 8y ago · link · parent
comment 8y ago · link · parent