He probably wouldn't win; but he might break the record set by Eugene V. Debs for most votes cast for a prisoner (or in this case, person exiled due to charges) as POTUS. At least, I'm assuming it's a record. From Wikipedia:
Debs ran for president in the 1920 election while in prison in Atlanta, Georgia, at the Atlanta Federal Penitentiary. He received 919,799,[39] write-in votes (3.4%),[40] slightly less than he had won in 1912, when he received 6%, the highest number of votes for a Socialist Party presidential candidate in the U.S.[4][41] During his time in prison, Debs wrote a series of columns deeply critical of the prison system. They appeared in sanitized form in the Bell Syndicate and were published in his only book, Walls and Bars, with several added chapters. It was published posthumously.[1]
But, but, but... it looked good on Star Trek, so it must be good in real life. Now if you'll excuse me, the contractor is arriving to replace all my swinging doors with sliders. Yeah, they're going to have to remove a lot of studs but fortunately none of them are structural. $17,000 estimated; but it's the door of the future so it's worth it.
Define lobbying. If I write my Congressman and say, "stop the dam". I've just lobbied. I think what you're really aiming at is, me writing the Congressman and saying, "Remember me? I'm one of your tier-1 donors who also donated an extra $100,000 to your PAC. Build the dam".
The former is a legitimate functioning of our system. The latter is bribery that flies under the radar because some lawyers baked just the right logic pretzel so, "money is speech".
IMHO, getting the money out is going to require an amendment to the Constitution. Soldiers give up their rights when they join the army. If you declare a candidacy, you should give up the right to speak during the campaign, except through a publicly funded channel. That's one idea. The devil is always in the details; but this seems like a good starting point to reason about the issue.
Really though, I just wish we had more integrity in our "leadership" and/or a more credible anti-corruption movement in the USA. We've been through things like this before and reformed it without an amendment.
I said $10,000 net worth. In other words, $2k bank deposits, a car worth $6k, and rounded out by another $2k of posessions that might be countable as "assets". A lot of people are in the category of having that or less, and living "payckeck to paycheck" but not qualifying for programs because they're income is too high--but it all goes right out the window for rent, gas and... health insurance.
Unless, of course you suffer a catastrophic illness or injury.
Unless you have a net worth worth protecting. Health insurance can't insure your health. In theory, it could prevent you from falling back on Medicaid and/or going into medical bankruptcy. In practice, it has even failed to do that in many cases. Many people, either because "the light bulb went on" or because they simply couldn't afford it, stopped buying. When you have a net worth of less than $10,000 it's arguable that you're foolish to spend $500/mo on an insurance plan. Instead, invest the money on things that might actually improve your health such as a gym membership, a good bike, roller skates, etc.
If you just sock the extra money away you're up to $16,000 in the first year, and until Bernanke squashed rates you could factor some compounding on top of that.
Start young, and you could be ready for the more serious problems that come along later, or start buying insurance when it actually makes sense. But NooooO. Then the insurance companies wouldn't make money.
They literally had to force us to buy it. I wouldn't be nearly so upset if it were single payer, with no insurance companies. Instead, we had to protect these useless cronies. If we didn't, the people who make Brawndo would be out of jobs. Health insurance has electionalytes. It's what politicians crave.
Sounds like somebody can't stand the idea that there might be people in this world who have brains *and* good looks. Maybe he's like a male version of Hedy Lamarr
Just because C is Turing complete doesn't mean that the problem of finding all undefined behavior in a program at compile-time is undecidable. The specification has many statements of the form, "this construct results in undefined behavior". Thus, the problem of finding undefined behavior reduces to "find all instances of constructs that result in undefined behavior". The spec is written such that humans can (in theory) identify each instance of undefined behavior. Otherwise, why write the spec in the first place?
So, IMHO the problem of detecting undefined behavior at compile-time is NOT equivalent to the halting problem. If it were, the general consensus would be that it's impossible for humans (as well as AI) to solve the problem, as opposed to it merely being difficult.
I think that unless an expert steps into this rather stale discussion, we're going to have to agree to disagree.
Diagnosing UB can be too demanding from the implementation, so the standard doesn't even require it. How would you diagnose incorrect usage of realloc? Add run-time checks? Write a special rule in the compiler so it knows about realloc? Extend the language with metadata? What if realloc is hidden behind a user-defined function? At some point you have to stop, otherwise you could even solve the halting problem.
The halting problem was proven impossible. I think designing an AI to detect undefined behavior is difficult but not impossible. Unlike Turing, I have no proof. If you could prove such an equivalence, then it really would be time to give up on C, or define all the undefined conditions.
From C89, section 3.4: "An arbitrary integer may be
converted to a pointer. The result is implementation-defined." You still have to be careful of course; but it's not as bad as undefined behavior. I suspect that the standard allows it for this very reason.
You go in for an oil change. It costs $5 no matter what. You get a statement from the auto insurance company that is "not a bill" which is a good thing, because it shows that you were charged $500/qt. for oil.
The $5 oil change would be great, except that your auto insurance bill is $3000/mo, up from $2700/mo last year. Your lucky though. You're a 40 year old driver who hasn't had a ticket in 15 years. Family man. You've heard the horror stories about the young people and seniors trying to get car insurance. You try not to worry about it.
The real trouble comes when you get a fender bender. Totally not your fault. Your car was parked, and somebody hit it. You've got to report that, or you'll lose coverage.
You can't get the dents knocked out anywhere near here. There's a great shop that does that down the block, but they're not in your car insurance company's provider network. Being a licensed mechanic doesn't mean squat if he's not in the network. It's $20 to have the dents fixed, but you don't even know what it would cost if you just went to Joe's down the block. $2000 for out of network dent repair. Not worth it, so you're driving 40 miles down the El Camino to Sunnyvale today.
You used to think, "maybe I'll just ride the bus". A lot of people did. Then they started requiring people to buy car insurance even if they didn't have a car. Most people will be drivers at some point in their lifetime. By requiring non-drivers to purchase car insurance, we will reduce the overall cost of car insurance for everybody.
At least, that's what the car insurance companies said while they drafted the 1600 page Federal Universal Car Car Act.
As for cars, well... I wish I could tell you they were cheaper. Really, I don't know. Your car insurance plan tells you what models you can buy, where you can buy one, and whether or not the state of your current vehicle meets the standards for repurchase. The actual cost of a vehicle is anybody's guess. The list in proprietary information. It's all in the fine print, you know. The copay is $1000 no matter what though. Pretty sweet deal. Used to be a $2000 copay under my old plan. Sigh... I really wanted a Ford F-150 though. Ford is out of network...
I think the compiler would be violating sequence points if it moved the division up.
However, I see your point with the for-loop and have experienced it first hand when I wanted to see how fast such a loop would run. I had put some stupid addition or something in there, and the sneaky compiler went ahead and optimized my loop into oblivion. I had to put a function call in the loop to make it generate loop code.
After reading over responses to my original post, and to other posts around here I've come to the following conclusion:
Programmers are invoking undefined behavior.
OK, aside from that I always figured that invoking undefined behavior could make your program blow up at runtime. I never thought about the possibility of undefined behavior occuring at compile-time. I certainly wouldn't rely on such behavior, no matter how fast it made my program run. I'd be at the mercy of the compiler author. Even if I used #ifdef checks for the operating system, compiler version, etc. I could get screwed. Such checks are legitimate for implementation defined behavior in the compiler or quirks of the operating system on which the program will run. They are NOT legitimate for getting away with undefined behavior, not if you want to claim your program is C or C++.
OK, that explains why I've been getting away with assuming they wrap since the Clinton administration. I don't know if anybody ever explained it to me in C terms. I always assumed that behavior was baked in at the CPU level, and just percolated up to C. I never felt inclined to do any "bit twiddling" with int or even fixed-width signed integers because on an intuitive level it "felt wrong". What's that four-letter personality type thing? I'm pretty sure I had the I for "intutive" there...
My statement is contradictory. I recommended a course of action for undefined behavior, while maintaining that Clang is wrong for documenting a course of action for undefined behavior.
My understanding of "undefined behavior" in the C spec is that it means "anything can happen and the programmer shouldn't rely on what the compiler currently does". Of course, in the real world *something* must happen. If a 3rd party documents what that something is, the compiler is still compliant. It's the programmer's fault for relying on it.
OTOH, if the behavior was "implementation defined" then the compiler authors can define it. If they change their definition from one rev to another without documenting the change, then it's the compiler author's fault for not documenting it.
In other words:
undefined -- programmer's fault for relying on it.
implemenation defined -- compiler's fault for not documenting it.
A cursory glance at this code suggests missiles will not be launched.
That's funny. My first takeaway is that the programmer is assuming malloc never fails. Let's get past that and assume that malloc and realloc both returned something. Most of us would assume it's unusual for realloc to do anything. We expect a==b to be true which makes (*a!=*b) impossible and the body of the if-block unreachable. So. I'm with you so far.
With clang, as I understand it, this is not true -missiles will be launched. The reason for this is that the spec says that the first argument of realloc becomes invalid after the call, therefore any use of that pointer has undefined behaviour. Clang takes advantage of this, and defines the behaviour of this to be that *a will not change after that point.
OK, if the spec says that a is undefined after the call to realloc, then IMHO the compiler should change the type of a from char * to UNDEFINED and complain. Based on what you're saying, it sounds like Clang is wrong. It sounds like they're treating undefined behavior as implementation defined behavior.
I'm sure somebody will correct me if I'm wrong on that one.
For example, overflows of unsigned values is undefined behaviour in the C standard.
I'm glad I didn't know that when I used to play with software 3d engines back in the 90s. 16-bit unsigned integer "wrap around" was what made my textures tile. I do seem to vaguely recall that there was a compiler flag for disabling integer traps and that I disabled it. It was Microsoft's C compiler, and it's been a loooooong time.
OK, I'm looking through the options on the 2005 free Visual Studio... I can find a flag to disable floating point traps, but not integer. Maybe the full version lets you do that. I used to have the full version. I suppose if it were really important I could track down the magic assembly voodoo incantation to do it. I'm guessing the MS disables integer overflow traps by default...
If my C code contains *foo=2, the compiler can't just leave that out. If my code contains if (foo) { *foo=2 } else { return EDUFUS; } it can verify that my code is checking for NULL pointers. That's nice; but the questions remain:
What is "unstable code" and how can a compiler leave it out? If the compiler can leave it out, it's unreachable code and/or code that is devoid of semantics. No sane compiler can alter the semantics of your code, at least no compiler I would want to use. I'd rather set -Wall and get a warning.
They must still have a few old geezers from Bullit County who are smart enough to get it done.
Joking aside, it's a *fast* web site; but you sill have to enable scripting. It's a bit of a "wall of text" which is surprising to me. Also, like all the exchanges I've seen so far, including California's, it's got those stupid social networking buttons on it. To Kentucky's credit, at least they're tucked way down at the bottom. Why, oh why do we need a friggin YouTube button on such a site??? WTF, really? You're gonna FaceBook a link to the page where you signed up, which shouldn't populate with data anyway. Please tell me it doesn't transmit all the form fields if you press the social networking buttons...
Using "freedom" or "patriot" in something is a dead giveaway. Anything like that is bound to suck. This extends to the formal name of the government. Anything that is a "democratic republic" is almost always a totalitarian state. God help us if we ever pass a "Glorious Free Democratic Republic Patriot Act".
Is an update really necessary? Isn't collusion already illegal? The only difference between this and some almond growers secretly meeting to fix prices is that the almonds are people. OMG, I just realized something. People are almonds, corporations are people, therefore... Corporations are almonds. I'm not sure exactly what we've discovered here; but I'm pretty sure it involves quantum mechanics and heavy drinking.
He probably wouldn't win; but he might break the record set by Eugene V. Debs for most votes cast for a prisoner (or in this case, person exiled due to charges) as POTUS. At least, I'm assuming it's a record. From Wikipedia:
But, but, but... it looked good on Star Trek, so it must be good in real life. Now if you'll excuse me, the contractor is arriving to replace all my swinging doors with sliders. Yeah, they're going to have to remove a lot of studs but fortunately none of them are structural. $17,000 estimated; but it's the door of the future so it's worth it.
Define lobbying. If I write my Congressman and say, "stop the dam". I've just lobbied. I think what you're really aiming at is, me writing the Congressman and saying, "Remember me? I'm one of your tier-1 donors who also donated an extra $100,000 to your PAC. Build the dam".
The former is a legitimate functioning of our system. The latter is bribery that flies under the radar because some lawyers baked just the right logic pretzel so, "money is speech".
IMHO, getting the money out is going to require an amendment to the Constitution. Soldiers give up their rights when they join the army. If you declare a candidacy, you should give up the right to speak during the campaign, except through a publicly funded channel. That's one idea. The devil is always in the details; but this seems like a good starting point to reason about the issue.
Really though, I just wish we had more integrity in our "leadership" and/or a more credible anti-corruption movement in the USA. We've been through things like this before and reformed it without an amendment.
Give them a break. Somebody made a funny noise in their office and now all their machines are infected with SlashDupeW32.exe.
At $10,000/year
I said $10,000 net worth. In other words, $2k bank deposits, a car worth $6k, and rounded out by another $2k of posessions that might be countable as "assets". A lot of people are in the category of having that or less, and living "payckeck to paycheck" but not qualifying for programs because they're income is too high--but it all goes right out the window for rent, gas and... health insurance.
Unless, of course you suffer a catastrophic illness or injury.
Unless you have a net worth worth protecting. Health insurance can't insure your health. In theory, it could prevent you from falling back on Medicaid and/or going into medical bankruptcy. In practice, it has even failed to do that in many cases. Many people, either because "the light bulb went on" or because they simply couldn't afford it, stopped buying. When you have a net worth of less than $10,000 it's arguable that you're foolish to spend $500/mo on an insurance plan. Instead, invest the money on things that might actually improve your health such as a gym membership, a good bike, roller skates, etc.
If you just sock the extra money away you're up to $16,000 in the first year, and until Bernanke squashed rates you could factor some compounding on top of that.
Start young, and you could be ready for the more serious problems that come along later, or start buying insurance when it actually makes sense. But NooooO. Then the insurance companies wouldn't make money.
They literally had to force us to buy it. I wouldn't be nearly so upset if it were single payer, with no insurance companies. Instead, we had to protect these useless cronies. If we didn't, the people who make Brawndo would be out of jobs. Health insurance has electionalytes. It's what politicians crave.
Sounds like somebody can't stand the idea that there might be people in this world who have brains *and* good looks. Maybe he's like a male version of Hedy Lamarr
Just because C is Turing complete doesn't mean that the problem of finding all undefined behavior in a program at compile-time is undecidable. The specification has many statements of the form, "this construct results in undefined behavior". Thus, the problem of finding undefined behavior reduces to "find all instances of constructs that result in undefined behavior". The spec is written such that humans can (in theory) identify each instance of undefined behavior. Otherwise, why write the spec in the first place?
So, IMHO the problem of detecting undefined behavior at compile-time is NOT equivalent to the halting problem. If it were, the general consensus would be that it's impossible for humans (as well as AI) to solve the problem, as opposed to it merely being difficult.
I think that unless an expert steps into this rather stale discussion, we're going to have to agree to disagree.
we had two countries telling us to watch the bomber
They should have e-mailed eachother. Then we would have caught it.
Diagnosing UB can be too demanding from the implementation, so the standard doesn't even require it. How would you diagnose incorrect usage of realloc? Add run-time checks? Write a special rule in the compiler so it knows about realloc? Extend the language with metadata? What if realloc is hidden behind a user-defined function? At some point you have to stop, otherwise you could even solve the halting problem.
The halting problem was proven impossible. I think designing an AI to detect undefined behavior is difficult but not impossible. Unlike Turing, I have no proof. If you could prove such an equivalence, then it really would be time to give up on C, or define all the undefined conditions.
IIRC, this issue came up and the workaround was:
From C89, section 3.4: "An arbitrary integer may be converted to a pointer. The result is implementation-defined." You still have to be careful of course; but it's not as bad as undefined behavior. I suspect that the standard allows it for this very reason.
You go in for an oil change. It costs $5 no matter what. You get a statement from the auto insurance company that is "not a bill" which is a good thing, because it shows that you were charged $500/qt. for oil.
The $5 oil change would be great, except that your auto insurance bill is $3000/mo, up from $2700/mo last year. Your lucky though. You're a 40 year old driver who hasn't had a ticket in 15 years. Family man. You've heard the horror stories about the young people and seniors trying to get car insurance. You try not to worry about it.
The real trouble comes when you get a fender bender. Totally not your fault. Your car was parked, and somebody hit it. You've got to report that, or you'll lose coverage.
You can't get the dents knocked out anywhere near here. There's a great shop that does that down the block, but they're not in your car insurance company's provider network. Being a licensed mechanic doesn't mean squat if he's not in the network. It's $20 to have the dents fixed, but you don't even know what it would cost if you just went to Joe's down the block. $2000 for out of network dent repair. Not worth it, so you're driving 40 miles down the El Camino to Sunnyvale today.
You used to think, "maybe I'll just ride the bus". A lot of people did. Then they started requiring people to buy car insurance even if they didn't have a car. Most people will be drivers at some point in their lifetime. By requiring non-drivers to purchase car insurance, we will reduce the overall cost of car insurance for everybody.
At least, that's what the car insurance companies said while they drafted the 1600 page Federal Universal Car Car Act.
As for cars, well... I wish I could tell you they were cheaper. Really, I don't know. Your car insurance plan tells you what models you can buy, where you can buy one, and whether or not the state of your current vehicle meets the standards for repurchase. The actual cost of a vehicle is anybody's guess. The list in proprietary information. It's all in the fine print, you know. The copay is $1000 no matter what though. Pretty sweet deal. Used to be a $2000 copay under my old plan. Sigh... I really wanted a Ford F-150 though. Ford is out of network...
I think the compiler would be violating sequence points if it moved the division up.
However, I see your point with the for-loop and have experienced it first hand when I wanted to see how fast such a loop would run. I had put some stupid addition or something in there, and the sneaky compiler went ahead and optimized my loop into oblivion. I had to put a function call in the loop to make it generate loop code.
After reading over responses to my original post, and to other posts around here I've come to the following conclusion:
Programmers are invoking undefined behavior.
OK, aside from that I always figured that invoking undefined behavior could make your program blow up at runtime. I never thought about the possibility of undefined behavior occuring at compile-time. I certainly wouldn't rely on such behavior, no matter how fast it made my program run. I'd be at the mercy of the compiler author. Even if I used #ifdef checks for the operating system, compiler version, etc. I could get screwed. Such checks are legitimate for implementation defined behavior in the compiler or quirks of the operating system on which the program will run. They are NOT legitimate for getting away with undefined behavior, not if you want to claim your program is C or C++.
OK, that explains why I've been getting away with assuming they wrap since the Clinton administration. I don't know if anybody ever explained it to me in C terms. I always assumed that behavior was baked in at the CPU level, and just percolated up to C. I never felt inclined to do any "bit twiddling" with int or even fixed-width signed integers because on an intuitive level it "felt wrong". What's that four-letter personality type thing? I'm pretty sure I had the I for "intutive" there...
My statement is contradictory. I recommended a course of action for undefined behavior, while maintaining that Clang is wrong for documenting a course of action for undefined behavior.
My understanding of "undefined behavior" in the C spec is that it means "anything can happen and the programmer shouldn't rely on what the compiler currently does". Of course, in the real world *something* must happen. If a 3rd party documents what that something is, the compiler is still compliant. It's the programmer's fault for relying on it.
OTOH, if the behavior was "implementation defined" then the compiler authors can define it. If they change their definition from one rev to another without documenting the change, then it's the compiler author's fault for not documenting it.
In other words:
undefined -- programmer's fault for relying on it.
implemenation defined -- compiler's fault for not documenting it.
That's funny. My first takeaway is that the programmer is assuming malloc never fails. Let's get past that and assume that malloc and realloc both returned something. Most of us would assume it's unusual for realloc to do anything. We expect a==b to be true which makes (*a!=*b) impossible and the body of the if-block unreachable. So. I'm with you so far.
OK, if the spec says that a is undefined after the call to realloc, then IMHO the compiler should change the type of a from char * to UNDEFINED and complain. Based on what you're saying, it sounds like Clang is wrong. It sounds like they're treating undefined behavior as implementation defined behavior.
I'm sure somebody will correct me if I'm wrong on that one.
For example, overflows of unsigned values is undefined behaviour in the C standard.
I'm glad I didn't know that when I used to play with software 3d engines back in the 90s. 16-bit unsigned integer "wrap around" was what made my textures tile. I do seem to vaguely recall that there was a compiler flag for disabling integer traps and that I disabled it. It was Microsoft's C compiler, and it's been a loooooong time.
OK, I'm looking through the options on the 2005 free Visual Studio... I can find a flag to disable floating point traps, but not integer. Maybe the full version lets you do that. I used to have the full version. I suppose if it were really important I could track down the magic assembly voodoo incantation to do it. I'm guessing the MS disables integer overflow traps by default...
If my C code contains *foo=2, the compiler can't just leave that out. If my code contains if (foo) { *foo=2 } else { return EDUFUS; } it can verify that my code is checking for NULL pointers. That's nice; but the questions remain:
What is "unstable code" and how can a compiler leave it out? If the compiler can leave it out, it's unreachable code and/or code that is devoid of semantics. No sane compiler can alter the semantics of your code, at least no compiler I would want to use. I'd rather set -Wall and get a warning.
They must still have a few old geezers from Bullit County who are smart enough to get it done.
Joking aside, it's a *fast* web site; but you sill have to enable scripting. It's a bit of a "wall of text" which is surprising to me. Also, like all the exchanges I've seen so far, including California's, it's got those stupid social networking buttons on it. To Kentucky's credit, at least they're tucked way down at the bottom. Why, oh why do we need a friggin YouTube button on such a site??? WTF, really? You're gonna FaceBook a link to the page where you signed up, which shouldn't populate with data anyway. Please tell me it doesn't transmit all the form fields if you press the social networking buttons...
I can't believe nobody has said "we don't need no steenking badges" yet, or pointed out that the exact lines of the quote are different
Using "freedom" or "patriot" in something is a dead giveaway. Anything like that is bound to suck. This extends to the formal name of the government. Anything that is a "democratic republic" is almost always a totalitarian state. God help us if we ever pass a "Glorious Free Democratic Republic Patriot Act".
Almonds are nuts in the culinary sense.
Just what we need. Another Europan war.
No, but I may have gone nuts and I'm surprised nobody has pointed that out yet.
Is an update really necessary? Isn't collusion already illegal? The only difference between this and some almond growers secretly meeting to fix prices is that the almonds are people. OMG, I just realized something. People are almonds, corporations are people, therefore... Corporations are almonds. I'm not sure exactly what we've discovered here; but I'm pretty sure it involves quantum mechanics and heavy drinking.