473,903 Members | 3,317 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

return values for void functions

REH
The other day I did something like this:

void foo
{
}

void bar()
{
return foo();
}

when I meant to do this:

void foo
{
}

void bar()
{
foo();
return;
}

I was suprised that it worked. Is this legal?

Thanks.

Jul 23 '05
23 1950
In message <ct**********@n ntp1.jpl.nasa.g ov>, E. Robert Tisdale
<E.************ **@jpl.nasa.gov > writes
Richard Herring wrote:
E. Robert Tisdale writes:
We have no way to determine whether their interpretations
of the ANSI/ISO standards are correct or not. We can read the standard for ourselves
and follow their reasoned arguments, can't we?


And, if we are ourselves infallible,
we can determine whether their interpretations
of the ANSI/ISO standards are correct or not.


In the vast majority of cases infallibility is not a requirement, just
an ability to read and understand carefully-worded technical English..
According to the American Heritage Dictionary of the English Language

http://www.bartleby.com/61/

hubris
NOUN: Overbearing pride or presumption; arrogance:
“There is no safety in unlimited technological hubris”
(McGeorge Bundy).
Yes. I know what it means. What's your point? Appeals to the dictionary
are usually a sign that one is losing the argument.
I have observed that, when the same question is submitted
to both comp.lang.c++ and comp.std.c++ independently,
Which question was that?
answers are challenged much more vigorously in comp.std.c++
The answers and challenges are much better and more reliable
in comp.std.c++
It appears that more experts on the ANSI/ISO C++ standards
subscribe and contribute to the comp.std.c++ newsgroup.
[...]
If you have questions about whether a code is "legal" or not,
consult your C++ compiler first.
Consult the Comeau on-line C++ compiler
if you don't trust your compiler.
Consult the experts in the comp.std.c++ newsgroups
if doubt or suspicion remains.
I love the way that when refuted by reasoned argument, you merely post
the same assertions again. It reminds me of Tom "scare quotes" Potter.
The comp.lang.c++ newsgroup is just a good place to get bad advice
on "legal" issues concerning ANSI/ISO C++ standards.


So why do you post it?

PS Is there some subtle reason why you keep referring to "ANSI/ISO C++
standards"? It's a bit of a mouthful and says nothing in this context
that the single word "standard" wouldn't convey.

--
Richard Herring
Jul 23 '05 #21
E. Robert Tisdale wrote:

[ ... ]
Ok, then I have a question.
If there are no compliant C++ compilers,
why would I trust one to judge if my code is compliant?


Because they are *more* reliable (trustworthy)
than contributers to the comp.lang.c++ newsgroup.
Compilers are written by professionals
who are much more expert in interpreting
the ANSI/ISO C++ standards
than the casual, pedestrian users
who contribute to the comp.lang.c++ newsgroup.


Notice that Greg Comeau not only posts to comp.lang.c++ in general, but
has even contributed a post elsewhere in this very thread.

For those who aren't aware of it, although it's true that no compiler
has perfect conformance at the present time, I think it's safe to state
as a fact that Greg's is the absolute best available in this respect.

IMO, E. Robert Tisdale implying that Greg Comeau is untrustworthy,
unreliable, unprofessional, or a "casual, pedestrian" user is downright
inexcusable. An abject apology is the bare minimum that should be
expected. While Greg is a nice enough person that I'd be surprised if
he initiated legal action against Mr. Tisdale, I honestly believe he'd
be fully justified in doing so. It would be a sad day indeed if Greg
Comeau lost even a single sale due to Mr. Tisdale's remarks, which I
consider exceptionally ill-considered at best.

--
Later,
Jerry.

The universe is a figment of its own imagination.

Jul 23 '05 #22
Jerry Coffin wrote:

Notice that Greg Comeau not only posts to comp.lang.c++ in general, but
has even contributed a post elsewhere in this very thread.

For those who aren't aware of it, although it's true that no compiler
has perfect conformance at the present time, I think it's safe to state
as a fact that Greg's is the absolute best available in this respect.


Do you mean the truly excellent compiler available at
http://www.comeaucomputing.com ?

The one that costs no more than a good reference on C++ ($50us), and is
much more useful in many ways?

The one with versions available for almost any platform that someone is
likely to be using?

Is THAT the compiler that you're talking about?
Jul 23 '05 #23
Howard Gardner wrote:

[ ... ]
Do you mean the truly excellent compiler available at
http://www.comeaucomputing.com ?

The one that costs no more than a good reference on C++ ($50us), and
is much more useful in many ways?

The one with versions available for almost any platform that someone
is likely to be using?

Is THAT the compiler that you're talking about?


Yes, that all sounds right to me.

--
Later,
Jerry.

The universe is a figment of its own imagination.

Jul 23 '05 #24

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

Similar topics

66
5058
by: Darren Dale | last post by:
Hello, def test(data): i = ? This is the line I have trouble with if i==1: return data else: return data a,b,c,d = test()
9
2737
by: Ann Huxtable | last post by:
I have the following code segment - which compiles fine. I'm just worried I may get run time probs - because it looks like the functions are being overloaded by the return types?. Is this Ok: ? template <class T1, class T2> int getValue( T1 col, T2 row ) ; template <class T1, class T2> double getValue( T1 col, T2 row ) ;
16
2013
by: G Patel | last post by:
Hi, If I want to call functions that don't return int without declaring them, will there be any harm? I only want to assign the function(return value) to the type that it returns, so I don't see how the return value comes to play here. Ex
15
2822
by: Nerox | last post by:
Hi, If i write: #include <stdio.h> int foo(int); int main(void){ int a = 3; foo(a); }
18
2466
by: skishorev | last post by:
Hi, Here I am taking two functions. void f(int,int) and another one is float f(int,int). Is it possible to overload with return values. Thx, kishore
4
6960
by: msolem | last post by:
I have some code where there are a set of functions that return pointers to each other. I'm having a bit of a hard time figuring out the correct type to use to do that. The code below works but I'm defining the functions as void*, and then casting when I use them. This code is going into a general purpose framework, and it would be much nicer if the user didn't need to do any casting. Can someone tell me how to set up those typedefs...
18
4078
by: Pedro Pinto | last post by:
Hi there once more........ Instead of showing all the code my problem is simple. I've tried to create this function: char temp(char *string){ alterString(string); return string;
2
4544
by: rsk | last post by:
Friends, The following logic just converts the hexadecimal values to the binay values taken into the array. for(i=31;i>=0;i--){ if ((1<<i)&var1) array_var1=1; else array_var1=0;
4
2492
by: barcaroller | last post by:
I am trying to adopt a model for calling functions and checking their return values. I'm following Scott Meyer's recommendation of not over-using exceptions because of their potential overhead. Here's the approach I'm currently looking at. I throw exceptions only from constructors. Destructors, of course, do not throw exceptions. All other functions return a signed integer. The values are all stored in one large header file (as...
0
9999
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
11283
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10875
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...
0
10501
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...
1
8049
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
7206
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5894
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
4727
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
2
4308
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.