Assign instead of return.
This is not really standard C, but works with every compiler and CPU that I know of:
int sqr(int a){return a*a;}
has the same effect as:
int sqr(int a){a*=a;}
Because the first argument is stored into the same CPU register as the return value.
X-Macros
Another u...
The Recursively Prime Primes is are sequence of primes such that
p(1) = 2
p(n) = the p(n-1)th prime
Here is an example of how one might calculate the 4th Recursively Prime Prime.
p(4) = the p(3)th prime
p(3) = the p(2)th prime
p(2) = the p(1)th prime
p(1) = 2
p(2) = the 2nd prime
p(2) = 3
p(...
@Doorknob I think eax is just a convenient register, so the compiler puts whatever it can there, and that happens to be where it looks for a return value later.
@Doorknob Not really. gcc doesn't try very hard to optimize by default, but it still recognizes int c = 42; as useless and optimizes it out. With -O1, the int c = a*b; version also stops working.
@KritixiLithos Both are useless, but the first is easier to recognize.
Anonymous
18:35
@KritixiLithos Because it references one of the args. Since gcc isn't trying too hard to optimize at default optimization, it doesn't expend the effort to realize that is the same.
Solve The Halting Problem
Write a program that will take the text of another program as input. Your program will examine the code and output a result that the program either halts or will keep running forever.
That's impossible? Nonsense! To show how wrong you are, I've written this program tha...
@KritixiLithos That's also an easy optimization, as -b+b is superfluous in all well-defined situations. This isn't the case for /b*b; you have to know the value of b to know the result.
@DJMcMayhem Yeah, it looks like gcc has reservations about this, even with -Ofast. Division by 0 is still UB though, so the compiler could technically optimize out *b/b out if it wanted to.
Peidiwch â gadael eich breuddwydion fod breuddwydion
Ddoe dywedasoch yfory
Felly dim ond yn ei wneud
Gwnewch eich breuddwydion yn dod yn wir
Dim ond yn ei wneud
@DJMcMayhem I would tokenise it, replace NAME tokens with your tested values with the builtin ones and then untokenise it and then run exec on it or something
This canopy was found near Wetumka, Oklahoma in a small creek running through my best friend's property. The canopy is about 12 feet long. Can anyone tell me what aircraft it came from, or who I could contact to ask?
A loving cup from 1906 dedicated to a Miss Grace Walling Spore from the USS All...
Please do not vandalize your own posts. If you really want to delete it, either hit the delete button, or flag it and ask a moderator to delete it for you. — DJMcMayhemOct 17 '16 at 1:10
@ATaco hmm, flagging an ungolfed answer is a bit too much, even for code-golf. The answer shouldn't win, maybe a few downvotes and a comment, but it is still a valid answer, is it not?
Scope
As I see it, there are five types of invalid answers:
Answers that produce incorrect results.
This is the most common type, and usually an accident.
Answers that produce correct results, but break a rule of the challenge, ignore parts of the spec or violate a loophole.
For example, ans...
FizzBuzz is so simple, bet you can do it backwards. In this challenge, you will be given the length of the FizzBuzz string and must give the positive integer that produced that string.
Description
To break this down, a FizzBuzz string for n is generated by the following algorithm.
Start with ...
Your task is to calculate the expected chance of winning for 2 players in some game, each with their own Elo Rating. Player A has ELO Ra and player B has ELO Rb
The expected score for Player A (Ea) is: 1 / (1 + 10(Rb - Ra) / 400). There is a similar equation for Player B (Ea): 1 / (1 + 10(Ra - R...
@Dennis that's wrong, at least based on the dc version I've always had. This input trick in base 10 using hex letters surely is used across this site, nothing new.
Everything works as intended. It's a very nice looking and stable KDE, and I had no problems with upgrades so far. Packages are not quite bleeding edge, but new enough and without weird bugs. That's a lot more than I can say about the distros I've tried before.