473,781 Members | 2,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What's the reason to use return value in parenthesis?

I've seen a lot of times using return value in parentesises -
{
....
return (true);
}

What's the reason for this? Can smb explait it?

PS: they do return predefined values, not calculated like returd (I*(d/4))
--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Feb 13 '06 #1
4 3747
Michael Nemtsev wrote:
I've seen a lot of times using return value in parentesises -
{
...
return (true);
}

What's the reason for this? Can smb explait it?

PS: they do return predefined values, not calculated like returd (I*(d/4))


There's no technical reason. In some cases it can increase readability,
but that's pretty rare IMO.

Jon

Feb 13 '06 #2
Michael,

I seem to remember very old C compilers (around 1974-75) that required these
parentheses, check for instance:

http://www.lysator.liu.se/c/bwk-tutor.html

For me, there's no reason for using them today.

Regards - Octavio
"Michael Nemtsev" <Mi************ @discussions.mi crosoft.com> escribió en el
mensaje news:1E******** *************** ***********@mic rosoft.com...
I've seen a lot of times using return value in parentesises -
{
...
return (true);
}

What's the reason for this? Can smb explait it?

PS: they do return predefined values, not calculated like returd
(I*(d/4))
--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do
not
cease to be insipid." (c) Friedrich Nietzsche

Feb 13 '06 #3
Hi,

"Michael Nemtsev" <Mi************ @discussions.mi crosoft.com> wrote in
message news:1E******** *************** ***********@mic rosoft.com...
I've seen a lot of times using return value in parentesises -
{
...
return (true);
}

What's the reason for this? Can smb explait it?


no reason at all, probably it's auto generated code, I frankly doubt
somebody owuld do it like that manually
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Feb 13 '06 #4
Basically, because it makes return look like a function. Note that in C
(and C++ and therefore C#), most constructs look like functions:
if(...)
while(...)
for(...)

One should note the in C/C++ there's no reason to wrap parens around the
operand of the sizeof operator -- still, most poeple do, because they think
of it as a function.
int l = sizeof long;
int i = sizeof(int);

This is noteworthy, because it C# cousin, typeof, *does* require parens,
even though there no more of a need for it then there is on sizeof or
return.
Type T = typeof(System.S tring);
--
Truth,
James Curran
[erstwhile VC++ MVP]

Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
"Michael Nemtsev" <Mi************ @discussions.mi crosoft.com> wrote in
message news:1E******** *************** ***********@mic rosoft.com...
I've seen a lot of times using return value in parentesises -
{
...
return (true);
}

What's the reason for this? Can smb explait it?

PS: they do return predefined values, not calculated like returd (I*(d/4)) --
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not cease to be insipid." (c) Friedrich Nietzsche

Feb 13 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

46
3305
by: Reinhold Birkenfeld | last post by:
Hello, another Perl/Python question: the subject says it all. Perl is going to change dramatically to become a more powerful and easier to (read|write) language. Is Python taking a similar step (-> Python 3) some time in the near future? Reinhold
32
8877
by: Mike Machuidel | last post by:
Hi, I'm a game developer programming mostly in C and ASM for about 7 years. Today at work a colleague (a C++ programmer) yelled at me I'm a bad C programmer because I use "return(0);" instead of "return 0;". He explained that "return" is not a function but a stament, like I didn't know already. The other colleagues also argreed with him :(. Can someone please explain what's so wrong about using "return" with
13
5058
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
49
14529
by: matty | last post by:
Hi, I recently got very confused (well that's my life) about the "undefined" value. I looked in the FAQ and didn't see anything about it. On http://www.webreference.com/programming/javascript/gr/column9/ they say: <snip> The undefined property A relatively recent addition to JavaScript is the undefined property.
17
2053
by: zhangyue.zl | last post by:
static void (DEVICE_REQUEST)(void); What does this line declare in C? I am always meeting some codes like this,but I have never learnt that before. It looks like a declaration of a function,but why DEVICE_REQUEST has to be quoted by ( ). Anyone can explain that to me? thanks a lot!
4
1423
by: mantrid | last post by:
Hello Hope you can help. I have been using the code below to move elenents around the page. This has worked fine until I put some arguments into the functions so I could use them in many places with out having to create lots of slightly different functions. The code that has now stoped working is below. My javascript is not great and I have been struggling with this all day. Can anyone see where Ive gone wrong Thanks Ian
4
1601
by: James | last post by:
What does this mean? 'To specify more than the first argument, you must use the MsgBox function in an expression' I'd love to see an example. Thanks!
6
18490
by: Daniel Rudy | last post by:
Hello Everyone, How do I return early from a void function? The following code does not compile. strata:/home/dr2867/c/modules 735 $$$ ->./compile unpifi.c unpifi gcc -W -Wall -Wshadow -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wnested-externs -Wwrite-strings -Wflo at-equal -Winline -Wtrigraphs -ansi -std=c89 -pedantic -ggdb3 -lc -o unpifi unpifi.c unpifi.c: In function `ifi_link_address': unpifi.c:146: error: syntax error...
14
9857
by: gimme_this_gimme_that | last post by:
What is going on here with the dollar signs and parenthesis? $(document).ready(function(){ $("li").behavior("click",function(){ $(this).load(menu.html"); }); }); And when do you use click vs. onclick? Is onclick only an attribute thing?
0
9639
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10143
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10076
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9939
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8964
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7486
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5375
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4040
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2870
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.