Top "Return-value" questions

Return value is the result of evaluation of a return statement.

C: Return value via stack/register question

I am new to C, and there is one thing I can not understand. When function returns something that is …

c function return-value calling-convention
T-SQL: returning the new INSERT identity to C#

i'm putting values into SQL Server using a Stored Procedure. The Procedure will add an ID to the row that …

c# sql return-value scope-identity
Using annotation to ensure that value returned by method is not discarded

String in Java is immutable. The following snippet is, broadly speaking, "wrong". String s = "hello world!"; s.toUpperCase(); // "wrong"!! System.…

java annotations return-value api-design
Why does int main() {} compile?

(I'm using Visual C++ 2008) I've always heard that main() is required to return an integer, but here I didn't put …

c++ return-value main
Passing functions which have multiple return values as arguments in Python

So, Python functions can return multiple values. It struck me that it would be convenient (though a bit less readable) …

python return-value function-calls
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::…

c++ reference return-value accessor
How can I return an anonymous struct in C?

Trying some code, I realized that the following code compiles: struct { int x, y; } foo(void) { } It seems as if …

c struct return-value c99 return-type
C++: is return value a L-value?

Consider this code: struct foo { int a; }; foo q() { foo f; f.a =4; return f;} int main() { foo i; i.…

c++ return-value lvalue
If a function returns no value, with a valid return type, is it okay to for the compiler to return garbage?

If a function has a return type other than void, and the function does not return anything, then I guess …

c++ c return-value initialization garbage
Returning after throwing exceptions

Is it in any way beneficial to return a value after throwing an exception? If not, can the return statement …

c++ exception return-value throw