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 ArticleIs 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 ArticleReturn instance by value from a method stack compilation
Can you explain why this won't compile:(this is the error: ../Man.cpp:33:9: error: conversion from ‘Man (*)()’ to non-scalar type ‘Man’ requested)Code:Man goo(){ Man m(); return m;}but this does:Man...
View ArticleMultiple 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 ArticleMy 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 ArticleIn 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 ArticleAccessing 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 ArticleWhy 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 ArticleReturn 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 ArticleIs 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 ArticleWhat decides if a value is returned from a PowerShell function?
I'm trying to figure out what dictates if a value is returned from a PowerShell function or not, and I've run into some oddities. The about_return docs say:In PowerShell, the results of each statement...
View ArticleMatlab: Abort function call with Strg+C but KEEP return value
I have a function in matlab with something like this:function [ out ] = myFunc(arg1, arg2) times = []; for i = 1:arg1 tic % do some long calculations times = [times; toc]; end % Return out = times;endI...
View ArticleWhy is "return by value" idiomatic in Rust (as opposed to out parameters)?
I am starting to learn Rust. In a lot of examples I have come across so far, I have noticed that functions are often implemented to return variables by value even if they are of a complex data type...
View ArticleHow to assign from a function which returns more than one value?
Still trying to get into the R logic... what is the "best" way to unpack (on LHS) the results from a function returning multiple values?I can't do this apparently:R> functionReturningTwoValues <-...
View ArticleCodeIgniter model method not returning value to controller
I'm using the count_all_results() function to return a user's number of languages spoken. But when I try to pass the number to the view, I keep getting a php undefined variable (for $lang_cnt). Below...
View ArticleCheck value of system function
I want to find the return value of the mount command which is passed into the system function using the C language. How can I do this?For example:printf("return val = %d",WEXITSTATUS(system(mount...
View ArticleWhat is the correct value of HTML 's `returnValue` per spec when the dialog...
Check this dialog box implementation.const open = document.getElementById('open')const dlg = document.getElementById('dlg')open.addEventListener('click', function () {...
View ArticleWhat does a function return if it does not contain a `return` statement?
I've watched some videos and they said "functions always return a value". If we don't use the return statement, then what does it return instead? Like the function below:function Foo(){ var x = 4. y...
View ArticleHow to execute shell command in Groovy and get the return code $?
I can't get the return code (not the output or error) from executing a shell script within Groovy.For all what I tried, it either asks me to escape or just print the $? instead of give me 1 or...
View ArticleIf an expression in a return modifies an earlier result parameter, does the...
For example, does the Go language spec guarantee the following will print true?https://go.dev/play/p/Rybua4uBb87package mainimport "fmt"func main() {...
View Article