3

What is the intention to put the return values ​​in parentheses in C / Objective...

 2 years ago
source link: https://www.codesd.com/item/what-is-the-intention-to-put-the-return-values-in-parentheses-in-c-objective-c.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

What is the intention to put the return values ​​in parentheses in C / Objective-C?

advertisements

I've come across some code that surrounds the return value from a method/function in parentheses.

What does that do?

The code I saw took an image, resized it and then returned it.

- (UIImage *)resizeImage:(UIImage *)image
{
    //
    // some fascinating, but irrelevant, resizing code here
    //

    return (image);
}


At least as far as C is concerned, it makes no difference. The parens aren't necessary, but they don't change the meaning of the return statement. The grammar of the return statement is

return-statement:
    return expressionopt ;

and one of the productions of the expression non-terminal is a parenthesized-expression, or ( expression ).

Related Articles

What is the return value of an assignment in vb.net?

What's the return value when I do an assignment? For example, can I do this? (i.e. the assignment returns the value being assigned) Dim a As Integer = 1 Dim b As Integer = 2 a = b = 3 The question came up when I wrote this code today: Dim updates = G

What is the return value of the given function when meeting an exception?

checkUsername() checks the username's length, and returns true when length is greater than or equal to 5. Otherwise it returns false. The function checkUsername() should return false on BadLengthException(), but it doesn't seem to appear as none of t

LIBGDX: What does the return value of a KeyDown, KeyUp & hellip of InputAdapter, etc. mean?

I am having problems handling inputs from more than one separate InputAdapters that use keyDown/keyUp. Gdx.input.setInputProcessor( new InputMultiplexer( keyboardController1, keyboardController2, keyboardController3)); Only the first one in line work

What is the return value of subprocess.call ()?

I am not sure what the return value of subprocess.call() means. Can I safely assume a zero value will always mean that the command executed successfully? Is the return value equivalent to the exit staus of a shell command? For example, will the follo

What is the return value of os.system () in Python?

I came across this: >>> import os >>> os.system('ls') file.txt README 0 What is return value of os.system()? Why I get 0?The return value of os.system is OS-dependant. On Unix, the return value is a 16-bit number that contains two differ

What is the return value of this function?

I write this function, but what's its return value. (defn read-data [file] (let [code (subs (.getName file) 0 3)] (with-open [rdr (clojure.java.io/reader file)] (drop 1 (line-seq rdr))))) (def d (read-data "data.db")) It's OK til now. But when I

What is the return value of alarm () if an alarm is already defined

In the Chapter 10 Signals of the APUE book, there is a sample code: #include <signal.h> #include <unistd.h> static void sig_alrm(int signo) { /* nothing to do, just return to wake up the pause */ } unsigned int sleep1(unsigned int seconds) { i

What is the return value of this conditional (groovy script)

What will be the return value of this if/else statement? if (salary <= 3000) { return discount < 0.40 } else { return discount < 0.60 } I'm not sure if the return value of each if and else will be a boolean or 0.40 and 0.60?It is a boolean. The &

What is the return value of PHP exec ()?

I am trying to use the PHP exec() function. If the return_var argument is present along with the output argument, then the return status of the executed command will be written to this variable. If the execution was successful, it's 0. However, if th

What is the return value of shared_ptr & lt; T & gt; :: get () after it is output?

After releasing a std::shared_ptr<T>, when I do ptr.get() is the return value NULL or nullptr? In order to compare, I used this: std::shared_ptr<int> ptr(new int(44)); ptr.reset(); int *p = ptr.get(); if (p == nullptr) { cout << "nu

In SharpSvn, what is the return value of SvnClient.getinfo?

In SharpSvn's documentation I found (here), the return value of SvnClient.getinfo (boolean type) is missing. Can anyone help with that? Thanks.Here's the answer I got: Usually all SvnClient methods return true on success and throw an error on failure

What determines the return value of Path.GetTempPath ()?

Currently, I use Path.GetTempPath() to figure out where to write my log files, but recently I came across a user's machine where the path returned was not what I expected. Usually, the returned path is C:\Documents and Settings\[userid]\Local Setting

What is the return value after a successful INSERT using sqlsrv_query () in PHP, MSSQL SERVER 2005?

Using the following simple code: $aQuery = "INSERT into myTable (a, b, c) VALUES (1, 'Hello', 'Goodbye')"; $result = sqlsrv_query($myConn, $aQuery ); //where $myConn is valid and defined elsewhere if (!$result) { echo 'FAIL'; } else { echo 'It w

C - What is the return value of a semicolon?

im just curious about the following example #include<stdio.h> int test(); int test(){ // int a = 5; // int b = a+1; return ; } int main(){ printf("%u\n",test()); return 0; } i compiled it with 'gcc -Wall -o semicolon semicolon.c' to create

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK