brackets surrounding ternary operator when creating Tuples in C

Top new questions this week:

Keyword ‘const’ does not make the value immutable. What does it mean?

There’s the const definition in Exploring ES6 by Dr. Axel Rauschmayer: const works like let, but the variable you declare must be immediately initialized, with a value that can’t be changed …

javascript ecmascript-6 const
asked by Mukund Kumar 45 votes
answered by Mike Post 53 votes

What is the operator “” in C++?

I fell on this page where the author talks about the standardisation of the operator “”: The decision of the C++ standards committee to standardise operator “” was […] What is he/she talking …

c++ operators language-design
asked by yolenoyer 37 votes
answered by Baum mit Augen 42 votes

Fitting largest circle in free area in image with distributed particle

I am working on images to detect and fit the largest possible circle in any of the free areas of an image containing distributed particles: (able to detect the location of particle). One direction …

matlab math image-processing geometry particle
asked by Tarun Kumar Agrawal 32 votes
answered by Ander Biguri 65 votes

dummy() function – What is that supposed to be?

So yesterday I read this question here on SO and stumbled over the best voted answer, wich used code like this to call a lambda recursively std::function<void(int)> f {[&f](int i){ …

c++ c++11
asked by muXXmit2X 25 votes
answered by Angew 42 votes

Generator Comprehension different output from list comprehension?

I get different output when using a list comprehension versus a generator comprehension. Is this expected behavior or a bug? Consider the following setup: all_configs = [ {‘a’: 1, ‘b’:3}, …

asked by Bas 22 votes
answered by TigerhawkT3 26 votes

What was the design rationale for making void not a primitive type?

When using reflection Type.IsPrimitive on a void type returns false.Coming from a C++ background this was surprising. Looking at the C# 6.0 spec (Page 82) does not mention the void type, which could …

c# language-lawyer
asked by crezefire 21 votes
answered by Patrick Hofman 31 votes

Python’s Passing by References

Hello I am trying to understand how Python’s pass by reference works. I have an example: >>>a = 1 >>>b = 1 >>>id(a);id(b) 140522779858088 140522779858088 This makes …

python literals python-internals
asked by Pulse 20 votes
answered by wim 35 votes

Greatest hits from previous weeks:

What does if __name__ == “__main__”: do?

What does the if __name__ == “__main__”: do? # Threading example import time, thread def myfunction(string, sleeptime, lock, *args): while 1: lock.acquire() time.sleep(sleeptime) …

python module namespaces main idioms
asked by Devoted 2593 votes
answered by Mr Fooz 2865 votes

For-each over an array in JavaScript?

How can I loop through all the entries in an array using JavaScript? I thought it was something like this: forEach(instance in theArray) Where theArray is my array, but this seems to be incorrect. …

javascript arrays loops foreach iteration
asked by Dante1986 2918 votes
answered by T.J. Crowder 5029 votes

Can you answer these?

Spock order tests by packages

He,everyone! My tests are running by jenkins from general package. Can I set test package in spock which will be runnning first and if in this package will not passed any of test the other tests …

java testing groovy spock
asked by V.Toristo 5 votes

Compile error without brackets surrounding ternary operator when creating Tuples in C#

I have encountered an error in C# with the new Tuple feature. If I use a ternary operator to determine a value for the tuple I must surround it with brackets. I didn’t expect this, because in method …

c# tuples ternary-operator c#-7.0
asked by harwoeck 5 votes

Is it possible to use the Idris FFI as an Effect?

Suppose I have a function of type Eff () [STDIO] in Idris. This lets you do basic console I/O operations, but does not allow you to use Idris’ foreign function interface. Is there an effect in idris …

asked by Sintrastes 5 votes