return-value

Returning different data type depending on the data (C++)

Is there anyway to do something like this? (correct pointer datatype) returnPointer(void* ptr, int depth) { if(depth == 8) return (uint8*)ptr; else if (depth == 16) return (uint16*)ptr; else return (uint32*)ptr; } Thanks ...

Which style of return should I use?

This is related to conventions used in C#. I've got a method that has two parameters (X and Y coordinates). These coordinates represent the position at which a "tile" may reside. If a tile resides at these coordinates, the method returns its number. If no tile resides at these coordinates, I'm wondering how the method should behave. ...

Is it possible to break out of a mysql stored procedure with something like return?

Apparently in mysql, you cannot use RETURN in a stored proc which is ridiculous because you can do it in mssql. ...

OracleType for a pl/sql function with a boolean return value?

Hi, I'm developing this app where I have to call a function written in PL/SQL that returns a boolean. As I understand, bool is not a type in SQL, but in PL/SQL, so what will the return type for the function be? command.Parameters.Add("P_RETURN", OracleType.???); (For the record: I have no control over the PL/SQL end of things, so I am...

Return Value from Stored Procedure not set

I have the following very basic stored procedure: CREATE PROCEDURE [dbo].[GetNumberToProcess] AS RETURN 999 I then have some code using Enterprise Library to run and get the return value: Dim cmd As DbCommand Dim ResultValue as String Dim lDBCommand as String = "dbo.GetNumberToProcess" Dim actionDB As...

How to return result of Sql Server stored procedure to .Net

What is the best way to return the result of the execution of a SQL Server stored procedure back to the .NET code? If I want to return the success or failure of a bunch of deletes in a transaction, should I 'Select' something, or maybe something like RETURN(1) or RETURN(0), or do I communicate number of rows affected? Then will this be...

How to make a function return a pointer to a function? (C++)

I'm trying to make a function that takes a character, then returns a pointer to a function depending on what the character was. I just am not sure how to make a function return a pointer to a function. ...

PHP function doesn't return value

I have a function which, given a filename and directory path, checks if the directory already contains a file with the same name and if so returns an amended filename (by appending a number after the first part of the filename). (The get_filenames() function is a CodeIgniter helper function which creates an array of all the filenames in ...

Is it good style to explicitly return in Ruby?

Coming from a Python background, where there is always a "right way to do it" (a "Pythonic" way, if you will) when it comes to style, I'm wondering if the same exists for Ruby. I've kind of been using my own style guidelines but I'm thinking about releasing my source code, and I'd like it to adhere to any unwritten rules that might exist...

How to get return value from a function in windbg?

I am trying to debug some win32API's like Createthread which returns a handle. How to get the return values in windbg? I did some research and found that return values generally stored in EAx register. If I put breakpoint on CreateThread then I can step into assembly of Createthread and ultimatelyw I will hit ret statement which means ...

Should I return std::strings?

I'm trying to use std::string instead of char* whenever possible, but I worry I may be degrading performance too much. Is this a good way of returning strings (no error checking for brevity)? std::string linux_settings_provider::get_home_folder() { return std::string(getenv("HOME")); } Also, a related question: when accepting stri...

How to delay a function from returning until after clicks have occurred

The following confirmDialog function is called midway through another jquery function. When this confirmDialog returns true the other function is supposed to continue... but it doesn't. The reason for this seems to be that the entire confirmDialog function has already executed (returning false) by the time the continue button gets clicke...

Return value from a stored proc on error

Hi there, I have an sp in SQL Server that when errors returns -4 what does -4 mean? Is there a table somewhere explaning what the possible return values are? ...

Return Data and Type of mysql_fetch_array()

Consider the following 3 standard statements $queryString = "SOME SQL SELECT QUERY"; $queryResult = mysql_query($queryString); $queryArray = mysql_fetch_array($queryResult); Question is : If the result set of the query is empty, what will be the resultant datatype and value of $queryArray after all three statements are executed ? ...

Can a Ruby method yield as an iterator or return an array depending on context?

I have an arbitrary method in Ruby that yields multiple values so it can be handed to a block: def arbitrary yield 1 yield 2 yield 3 yield 4 end arbitrary { |x| puts x } I'd like to modify this method so that, if there is no block, it just returns the values as an array. So this construct would work as well: myarray = arbitr...

What is LogonUser()'s token returned used for?

Hey Folks, What can you do with the token LogonUser returns? And what is it used for? BOOL LogonUser( __in LPTSTR lpszUsername, __in_opt LPTSTR lpszDomain, __in LPTSTR lpszPassword, __in DWORD dwLogonType, __in DWORD dwLogonProvider, __out PHANDLE Token ); I just need a more general discription an...

ANT Script handling Return value from exec

So this is the scenario. I have <target name="test"> <property file="blah"></property> <exec dir="" executable="trast.exe" resolveexecutable="true" spawn="true"> </exec> </target> <!-- So now I have the second target that uses Return value from first target --> <target name="test2"> <property file="blah"></property> <ex...

Return value of process

How can I get the return value of a process? Basically I'm ShellExecute()ing a .NET process from a DLL (in C++). The process does its task, but now I want to know whether it succeeded or failed. How to do that in WinAPI or MFC? ...

Is returning a std::list costly?

I was wondering if returning a list, instead of returning a pointer to one, was costly in term of performance because if I recall, a list doesn't have a lot of attributes (isn't it something like 3 pointers? One for the current position, one for the beginning and one for the end?). ...

Best practice when returning something from a routine.

What’s the best practice when returning something from a routine? Should I return a status bit always or just on failure? For example: Return(0, “Failed because….”) on failure, Return(1, success_value, second_success_value) on success. Or Return(0, “Failed because….”) on failure, Return( success_value, second_success_value) on success...