Stack Overflow Weekly Newsletter
Stack Overflow Weekly Newsletter

Top new questions this week:

Times two faster than bit shift?

I was looking at the source of sorted_containers and was surprised to see this line: self._load, self._twice, self._half = load, load * 2, load >> 1 Here load is an integer. Why use bit shift ...

python performance python-3.x bit-shift  
asked by Yakym Pirozhenko 55 votes
answered by Dan Getz 58 votes

Is it safe to rename argc and argv in main function?

A lot of programs use standard names for a number of arguments and arrays of strings. The prototype of main function looks like: int main(int argc, char *argv[]);. But would I break something if I ...

c++ c main  
asked by yanpas 48 votes
answered by dbush 68 votes

'\0' evaluates false, "\0" evaluates true

Inspired by a program described in K&R section 5.5: void strcpy(char *s, char *t) { while(*s++ = *t++); } C program if ('\0') printf("\'\\0\' != false\n"); if ("\0") printf("\"\\0\" != ...

c arrays string null evaluation  
asked by Rahn 41 votes
answered by immibis 95 votes

Why would one use MACRO+0 !=0

In my current codebase I see this following pattern: #if SOMETHING_SUPPORTED+0 != 0 ... #endif Unfortunately this is a very old codebase and nobody knows how and why it started. I think it started ...

c++ c  
asked by Felics 31 votes
answered by Kaz 20 votes

Why can't AtomicBoolean be a replacement for Boolean?

The Oracle JDK Javadoc for AtomicBoolean states: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/AtomicBoolean.html A boolean value that may be updated atomically. See the ...

java api-design  
asked by Brooks 29 votes
answered by AR.3 28 votes

Are side effects everything that cannot be found in a pure function?

Is it safe to say that the following dichotomy holds: Each given function is either pure or has side effects If so, side effects (of a function) are anything that can't be found in a pure ...

scala haskell f# functional-programming purely-functional  
asked by Aleksey Bykov 28 votes
answered by Tomas Petricek 53 votes

In what order are function arguments destroyed?

If some function f with parameters p_1, ..., p_n of types T_1, ..., T_n respectively is called with arguments a_1, ..., a_n and its body throws an exception, finishes or returns, in what order are the ...

c++ function arguments language-lawyer  
asked by jotik 24 votes
answered by 6502 12 votes

Greatest hits from previous weeks:

Generating random integers in a specific range

I am trying to generate a random intvalue with Java, but in a specific range. For example: My range is 5-10, meaning that 5 is the smallest possible value and 10 is the biggest. Any other number in ...

java random integer range  
asked by user42155 1796 votes
answered by Greg Case 1996 votes

What and where are the stack and heap?

Programming language books explain that value types are created on the stack, and reference types are created on the heap, without explaining what these two things are. I haven't read a clear ...

memory-management language-agnostic stack heap  
asked by mattshane 4908 votes
answered by Jeff Hill 3474 votes

Can you answer these?

Elm Compiler running forever, computer just getting hot

I'm not sure what's causing this issue, but in a project I'm building, the compiler is taking hours just to compile a module. The total size of my codebase is 352KB, but none of the modules are over ...

haskell switch-statement pattern-matching elm  
asked by Athan Clark 5 votes

MPMoviePlayerController behavior when moving to background / ResignActive

I want to change playback behavior of MPMoviePlayerController when moving to background / ResignActive to be as other app's (e.g. youtube) When moving to background pause when return to foreground ...

ios mpmovieplayercontroller  
asked by Ido Nave 5 votes

Using RSA for modulo-multiplication leads to error on Java Card

Hello I'm working on a project on Java Card which implies a lot of modulo-multiplication. I managed to implement an modulo-multiplication on this platform using RSA cryptosystem but it seems to work ...

java cryptography rsa javacard  
asked by Drago 6 votes
Subscribe to more Stack Exchange newsletters


Unsubscribe from this newsletter or change your email preferences by visiting your subscriptions page on stackexchange.com.

Questions? Comments? Let us know on our feedback site. If you no longer want to receive mail from Stack Exchange, unsubscribe from all stackexchange.com emails.

Stack Exchange, Inc. 110 William St, 28th Floor, NY NY 10038 <3