Stack Overflow Weekly Newsletter
Stack Overflow Weekly Newsletter

Top new questions this week:

Strange code that compiles with g++

The following code compiles successfully with g++ 4.8.1: int main() { int(*)(); } It looks like a simple declaration of a pointer to function: int(*f)(); It doesn't compile with clang 3.4 …

c++ gcc c++11 g++  
asked by Constructor 51 votes
answered by Vlad from Moscow 9 votes

Why can't GCC optimize this simple code?

Here are two functions which I claim do exactly the same thing: bool fast(int x) { return x & 4242; } bool slow(int x) { return x && (x & 4242); } Logically they do the same …

c++ gcc optimization compiler-optimization  
asked by John Zwinck 49 votes
answered by MSalters 44 votes

Why does this Java 8 program not compile?

This program compiles fine in Java 7 (or in Java 8 with -source 7), but fails to compile with Java 8: interface Iface<T> {} class Impl implements Iface<Impl> {} class Acceptor<T …

java generics type-inference java-8  
asked by ghik 44 votes
answered by nosid 18 votes

Assigning Code To A Variable

Is it possible to make a variable, and assign a line of code to it, such as: ButtonClicked = (MessageBox.Show("Hello, World!")); ... so when I use the variable, it will execute the line of code.

c# variables  
asked by user3539891 41 votes
answered by Grant Winney 16 votes

Are C# properties actually Methods?

Till now, I was under the impression that Properties & Methods are two different things in C#. But then I did something like below. and this was an "Eye Opener" to me. I was expecting one …

c# .net oop  
asked by yogi 39 votes
answered by dcastro 54 votes

Why d{motion} command is not consistent with {motion} command in Vim?

Experiment 1 Open Vim, and insert only the following line of text in the buffer. hello world In other words, press i, type hello world and press Esc. Press 0 to position the cursor at the first …

vim  
asked by Lone Learner 26 votes
answered by romainl 31 votes

Why does this assignment cause NPE?

public class Npe { static class Thing { long value; } public static Map<Thing, Long> map; public static void main(String[] args) { Thing thing = new Thing(); …

java nullpointerexception ternary-operator  
asked by David Wasser 22 votes
answered by Rohit Jain 26 votes

Greatest hits from previous weeks:

How can I prevent SQL injection in PHP?

If user input is inserted without modification into an SQL query, then the application becomes vulnerable to SQL injection, like in the following example: $unsafe_variable = $_POST['user_input']; …

php mysql sql security sql-injection  
asked by Andrew G. Johnson 2698 votes
answered by Theo 2841 votes

How do JavaScript closures work?

Like the old Albert Einstein said: If you can't explain it to a six-year old, you really don't understand it yourself. Well, I tried to explain JavaScript closures to a 27-year old friend and …

javascript closures  
asked by e-satis 2643 votes
answered by Ali 1886 votes

Can you answer these?

Single-threaded program profiles 15% of runtime in semaphore_wait_trap

On Mac OS using mono, if I compile and profile the program below, I get the following results: % fsharpc --nologo -g foo.fs -o foo.exe % mono --profile=default:stat foo.exe ... Statistical samples …

f# mono profiling  
asked by Søren Debois 5 votes

GUID prefixes \??\ and \\?\

What is the difference between GUID prefixed with \??\ and GUID prefixed with \\?\ At Windows 7 CMD-Line DIR gives: …

windows winapi batch-file cmd guid  
asked by user3518601 8 votes

Is there a way to make GHC provide the type class constraints of typed holes?

Current behavior Prelude> show _ <interactive>:7:6: Found hole ‘_’ with type: a0 Where: ‘a0’ is an ambiguous type variable Relevant bindings include it :: String (bound at …

haskell types ghc  
asked by Wizek 9 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