Quantcast
Channel: Active questions tagged return-value - Stack Overflow
Browsing latest articles
Browse All 210 View Live

window.opener.returnValue in Chrome with showModalDialog

I am trying to use window.opener.returnValue with showModalDialog. There are numerous references to a technique which can be used to workaround window.returnValue not working. However it just doesn’t...

View Article


How to force compilation error if function return value is not checked?

I want the compiler to emit an error if I'm using a specific function without checking its return value.I'm using GCC in eclipse.For example :int fun (){ return 3;}void main (){ printf("%d",fun ());}I...

View Article


How to detect QObject::moveToThread() failure in Qt5?

The documentation on QObject::moveToThread() for Qt5.3 explains that the moveToThread() method can fail if the object has a parent. How would I detect this failure in my code?I realize that simply...

View Article

import script value in different script with new results (diceroller)

I'm learning to write python to create scripts to automate stuff for DD.And I'm positive that there most likely is a built in solution for this.I have certain functions from external scripts that I...

View Article

Ruby quirk: Using 'return' to get a nil value

I am doing a problem at Rubymonk where I have to test if an array is 'nil' before doing an operation (adding items inside a nested array but that is not really relevant to the question). I notice,...

View Article


Return type for *this in a builder-class method - lvalue vs rvalue refence

Suppose I have a "builder" class B which builds a class C, and looks somewhat like the following:class B {public: // ... B& set_foo(Foo a_foo) { foo_ = std::move(a_foo); return *this; } C build()...

View Article

How is the return value of a method ignored in Java? [closed]

I'm trying to understand how the return value of the HashSet.add() method is handled in Java when it's not used in a condition or assigned to a variable. Here's an example of what I...

View Article

What should main() return in C and C++?

What is the correct (most efficient) way to define the main() function in C and C++—int main() or void main()— and why? And how about the arguments?If int main() then return 1 or return 0?

View Article


What's does a bash function return when there is no “return” statement?

Is the return value of a bash function the status of the last executed command?I wrote this test and it looks like it's so. I just want to verify. No one has asked this question before apparently and...

View Article


Are two dictionary lookups triggered when assigning and returning a...

Consider this C# example:public sealed class TestClass { private Dictionary<string,int> myDictionary = []; public int TestMethod() => myDictionary["foo"] = 3;}Internally, when TestMethod() is...

View Article

Creating a custom filter [duplicate]

I am wanting some help with inputting a value into a filter line. The variable in the raw dataset changes it's name each year to the corresponding year and I don't want to replace it in all the code...

View Article

Return multiple values from a function, sub or type?

So I was wondering, how can I return multiple values from a function, sub or type in VBA?I've got this main sub which is supposed to collect data from several functions, but a function can only return...

View Article

How to call a function and return data from a function to the global scope?

I created an HTML form that, on submit, opens submit_form.php. Inside, I process the data entered into the form and send a confirmation email. I wrote a function for the mail-sending-process.Inside the...

View Article


Platform dependent implementations with return values do not work in MAUI

I have problems to implement any platform dependent classes in a MAUI project. The compiler produces errors if I use a method which has a return value.I implemented the function first for each platform...

View Article

Return a QString from a function - thread safe?

I'm new to Qt - but this may be a very basic c++ issue. I have a simple function that returns a QString:QString testclass::myfunc(int i){ QString result; switch (i) { case 1: result = "one"; break;...

View Article


Best practice: ref parameter or return value?

Actually I am doing a list as a reference parameter as follows:public static List ListMethod(List result)I saw some people doing in this way too:public static void ListMethod(ref List result)If I'm not...

View Article

Return multiple values from a C# asynchronous method

I have worked with asynchronous methods and the methods which return multiple values, separately. In this specific situation, following "GetTaskTypeAndId()" method should be asynchronous and should...

View Article


Should accessors return values or constant references?

Suppose I have a class Foo with a std::string member str. What should get_str return?std::string Foo::get_str() const{ return str;}orconst std::string& Foo::get_str() const{ return str;}What is...

View Article

Return value in a Bash function

I am working with a bash script and I want to execute a function to print a return value:function fun1(){ return 34}function fun2(){ local res=$(fun1) echo $res}When I execute fun2, it does not print...

View Article

What does it mean to return a value?

I'm fairly new to programming, and I'm confused about what it means exactly to return a value. At first, I thought it meant to output what value is being returned, but when I tried that in my own code,...

View Article

Android Bluetooth - createBond return value

I am working on a Bluetooth application. It consists, among other things, of a list view displaying the paired and visible devices. Long clicking on the unpaired ones opens up the pairing dialog which...

View Article


How to catch the duration and return value of many python parallel sub-process

I need to write some code in python that launches 8 processes in parallel and that, for each process, is able to report their return value and their duration in microseconds.Unfortunately I don't know...

View Article


Is there a "return NULL" equivalent for return-by-reference functions?

I'm working with existing code that returns a reference, something like this:int &func(){ static int i = 5; return i;}I would like to return an error case as "NULL" but of course NULL doesn't work...

View Article

Multiple values in single-value context

Due to error handling in Go, I often end up with multiple values functions. So far, the way I have managed this has been very messy and I am looking for best practices to write cleaner code.Let's say I...

View Article

My factorial function is not returning factorial

I am not able to find out why my function returns the user input only rather then the factorial of the input.#include <stdio.h>#include <math.h>int factorial(int x){ //int x; int sum = 1;...

View Article


In php, should I return false, null, or an empty array in a method that would...

I've found several responses to this, but none pertaining to PHP (which is an extremely weak typed language):With regards to PHP, is it appropriate to return false, null, or an empty array in a method...

View Article

Image may be NSFW.
Clik here to view.

Accessing PSCustomObject Properties After Return from Function in PowerShell

I am working on a HealthCheck script that will check if a specific application is installed and verify the version number of the app, and verify id the service for that app is running. For testing...

View Article

Why does this CodeIgniter controller method always redirect after calling the...

I'm building a log in for my website. I have this if statement:$application = 'home';$this->user_model->loggedin() == TRUE || redirect($application);$rules =...

View Article

Return value from a stored proc on error

I have an sp in SQL Server that when errors returns -4What does -4 mean? Is there a table somewhere explaining what the possible return values are?There must be some standardFor exampledeclare @RetVal...

View Article



Is there a benefit to using a return statement that returns nothing?

I'm refactoring a large javascript document that I picked up from an open source project. A number of functions use inconsistent return statements. Here's a simple example of what I mean:var func =...

View Article
Browsing latest articles
Browse All 210 View Live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>