Stack Overflow Weekly Newsletter
Stack Overflow Weekly Newsletter

Top new questions this week:

Java method with return type compiles without return statement

Question 1: Why does this compile public int a() { while(true); } without having a return statement? Question 2: On the other hand, why does this public int a() { while(0 == 0); } ...

java while-loop return  
asked by haywire 149 votes
answered by T.J. Crowder 188 votes

Why does this for loop exit on some platforms and not on others?

I have recently started to learn C and I am taking a class with C as the subject. I'm currently playing around with loops and I'm running into some odd behaviour which I don't know how to explain. ...

c debugging undefined-behavior buffer-overflow  
asked by JonCav 84 votes
answered by QuestionC 128 votes

Python if not == vs if !=

What is the difference between these two lines of code: if not x == 'val': and if x != 'val': Is one more efficient than the other? Would it be better to use if x == 'val': pass else:

python if-statement equality  
asked by lafferc 64 votes
answered by jonrsharpe 108 votes

How does the below program output `C89` when compiled in C89 mode and `C99` when compiled in C99 mode?

I've found this C program from the web: #include <stdio.h> int main(){ printf("C%d\n",(int)(90-(-4.5//**/ -4.5))); return 0; } The interesting thing with this program is that ...

c printf c99 c89  
asked by Cool Guy 53 votes
answered by Paul Rubel 58 votes

In c++11 what should happen first: raw string expansion or macros?

This code works in visual c++ 2013 but not in gcc/clang: #if 0 R"foo( #else int dostuff () { return 23; } // )foo"; #endif dostuff(); Visual C++ removes the if 0 first. Clang expands the R raw ...

c++ c++11 preprocessor rawstring  
asked by starmole 35 votes
answered by Tony D 29 votes

Will my compiler ignore useless code?

I've been through a few questions over the network about this subject but I didn't find any answer for my question, or it's for another language or it doesn't answer totally (dead code is not useless ...

c# .net compiler-optimization dead-code  
asked by Thomas 28 votes
answered by Thomas 1 vote

Is there an elegant way to make every method in a class start with a certain block of code?

I have a class where every method starts the same way: class Foo { public void bar() { if (!fooIsEnabled) return; //... } public void baz() { if (!fooIsEnabled) return; //...

java design-patterns  
asked by kristina 27 votes
answered by sstan 14 votes

Greatest hits from previous weeks:

jQuery scroll to element

I have this input element: <input type="text" class="textfield" value="" id="subject" name="subject"> Then I have some other elements, like other text inputs, textareas, etc. When the user ...

asked by DiegoP. 828 votes
answered by Steve 1764 votes

How can I concatenate string variables in Bash?

In PHP I would add strings together like this: $foo = "Hello"; $foo .= " World"; So $foo would be "Hello World" How would I do that in Bash?

bash shell unix append string-concatenation  
asked by Strawberry 733 votes
answered by codaddict 1031 votes

Can you answer these?

Is it possible for this code to lose some matches?

During my NodeJS learning journey I found this sample code in a book (NodeJS in Practice) which uses streams to find some matches in data coming from another stream. var Writable = ...

javascript node.js  
asked by mehrandvd 7 votes

TaskAwaiter cannot be inferred from the ussage

I get a red line under my await in my code saying: The type arguments for method 'TaskAwaiter<TResult> System.WindowsRuntimeSystemExtensions.GetAwaiter<TResult>(this ...

c# async-await  
asked by Christian Bekker 6 votes

How to NOT deliver AppleWatch part of iOS app

We have a client using our source code. This project includes Apple Watch, but they do not want to build that into their app yet. They removed the Embed App Extensions. They were able to submit to ...

ios ios8 watchkit apple-watch ios8.2  
asked by Jason Hocker 5 votes
Subscribe to more Stack Exchange newsletters

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

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

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