472,372 Members | 1,559 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,372 software developers and data experts.

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 #1
23 1789
REH wrote:
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?


Yes.

V
Jul 23 '05 #2
That is important because if you have a series if if statments. You
can get out of the function when your condition is met. There is also
void func(int &a, int &b, char &c){}

Jul 23 '05 #3
REH wrote:
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.


Yes it is, and the fact that it is lets you cover the case of a function
returning void with code like:

template < typename xResult >
xResult foo(xResult (*fFunc)())
{
return (*fFunc)();
}

instead of making you write a special case that handls functions that
return void, for example:

void foo(void (*fFunc)())
{
*fFunc();
}

Having to write that second case to cover a return type of void would be
a major pain.
Jul 23 '05 #4
REH

"enki" <en*****@yahoo.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
That is important because if you have a series if if statments. You
can get out of the function when your condition is met. There is also
void func(int &a, int &b, char &c){}


I'm not sure what your point is.

Jul 23 '05 #5
REH wrote:
The other day I did something like this: cat foo.cc void foo { }

void bar(void) {
return foo();
}
g++ -Wall -ansi -pedantic -c foo.cc foo.cc:1: error: invalid function declaration
foo.cc: In function `void bar()':
foo.cc:4: error: `foo' undeclared (first use this function)
foo.cc:4: error: (Each undeclared identifier \
is reported only once for each function it appears in.)
foo.cc:4: error: return-statement with a value, \
in function returning 'void'

You probably meant:
cat foo.cc void foo(void) { }

void bar(void) {
return foo();
}
g++ -Wall -ansi -pedantic -c foo.cc
nm foo.o 00000006 T _Z3barv
00000000 T _Z3foov c++filt _Z3barv bar() c++filt _Z3foov foo()
when I meant to do this:

void foo(void) { }

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

I was suprised that it worked.
I'm surprised too. My compiler doesn't like it.
Are you "sure" that
you actually compiled the code that you posted?
Is this legal?


You probably shouldn't ask a question like this
in the comp.lang.c++ newsgroup.
Some of our subscribers know a lot about the standards
but the real experts are the compiler developers.
Submit your code to your compiler with options set
for standard error checking and all warnings
and it will tell you whether your code is legal or not.
If you don't trust your compiler, submit your code to
Greg Comeau's free online compiler at

http://www.comeaucomputing.com/tryitout/

The compiler is a *much* more reliable judge of legal C++ code
than "some guy" who subscribes to the comp.lang.c++ newsgroup.
Jul 23 '05 #6

"E. Robert Tisdale" <E.**************@jpl.nasa.gov> wrote in message
news:ct**********@nntp1.jpl.nasa.gov...
REH wrote:
The compiler is a *much* more reliable judge of legal C++ code
than "some guy" who subscribes to the comp.lang.c++ newsgroup.


I think that's a pretty bad assessment. How can someone know if their
compiler is any good (compliant), if they don't themselves know what should
be correct? This newsgroup has some folks who are pretty darn good at
interpreting the standard doc's and presenting the OP with good responses.
Who would you trust, your VC++ 6.0 compiler, or one of the regulars here?
I'd listen to the regulars (and the FAQ), myself.

-some guy
Jul 23 '05 #7
In article <ct*********@cui1.lmms.lmco.com>, REH <bo***@nowhere.net> wrote:
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?


Notwithstanding that your foo above is defined incorrectly,
yes, it's legal. Section 6.6.3p3 of Standard C++ reads:
"A return statement with an expression of type "cv void"
can be used only in functions with a return type of cv void;
the expression is evaluated just before the function returns
to its caller."

In case that's not clear 3.9.3p5 reads:
"In this International Standard, the notation cv (or cv1, cv2, etc.),
used in the description of types, represents an arbitrary set of
cv-qualifiers, i.e., one of {const}, {volatile}, {const, volatile},
or the empty set."

As you mentioned, despite the legality, it may not necessarily
be what you wanted, or it may be (this becomes more transparent
with templates).
--
Greg Comeau / Comeau C++ 4.3.3, for C++03 core language support
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Jul 23 '05 #8
Some guy wrote:
E. Robert Tisdale wrote:
The compiler is a *much* more reliable judge of legal C++ code
than "some guy" who subscribes to the comp.lang.c++ newsgroup.
I think that's a pretty bad assessment.
How can someone know if their compiler is any good (compliant)
if they don't themselves know what should be correct?


First of all, there are *no* C++ compiler which comply fully
with the ANSI/ISO standards. The Comeau compilers come very close.
It is practically impossible for programmers to determine
for themselves whether any implementation complies or not.
This newsgroup has some folks
who are pretty darn good at interpreting the standard doc's
And many more who are not.
How to you tell the difference.
and presenting the OP with good responses.
Who would you trust, your VC++ 6.0 compiler, or one of the regulars here?
I *don't* trust the "regulars here".
The comp.lang.c++ newsgroup is *not* the most appropriate forum
to discuss the ANSI/ISO C++ standards or whether or not
any particular implementation complies.
The comp.std.c++ newsgroup is more appropriate.
The comp.std.c++ newsgroup attracts real experts
on the ANSI/ISO C++ standards so contributions
are more likely to be properly vetted.
I'd listen to the regulars (and the FAQ), myself.


That's probably bad advice. The first problem is that
we have no way to determine who the "regulars" are
much less whether or not they have any credentials,
training or experience in C++ compiler implementation.
We have no way to determine whether their interpretations
of the ANSI/ISO standards are correct or not.
Jul 23 '05 #9

E. Robert Tisdale wrote:
Some guy wrote:
E. Robert Tisdale wrote:
The compiler is a *much* more reliable judge of legal C++ code
than "some guy" who subscribes to the comp.lang.c++ newsgroup.
I think that's a pretty bad assessment.
How can someone know if their compiler is any good (compliant)
if they don't themselves know what should be correct?


First of all, there are *no* C++ compiler which comply fully
with the ANSI/ISO standards. The Comeau compilers come very close.
It is practically impossible for programmers to determine
for themselves whether any implementation complies or not.


In all honesty, when you get to the point where Comeau is, you
discover that the standard is slightly fuzzy. It's not unusual
for a Comeau user to discover that some obscure case in the
standard cannot be implemented. Just have a look at the Core DR
lists.
I *don't* trust the "regulars here".
The comp.lang.c++ newsgroup is *not* the most appropriate forum
to discuss the ANSI/ISO C++ standards or whether or not
any particular implementation complies.
The comp.std.c++ newsgroup is more appropriate.
The comp.std.c++ newsgroup attracts real experts
on the ANSI/ISO C++ standards so contributions
are more likely to be properly vetted.


Of course, the clc++m group attracts real experts as well. Reason
is simple, moderation keeps the traffic low enough. In fact, such
a trivial question would fit better here or in clc++m than in csc++
I'd listen to the regulars (and the FAQ), myself.


That's probably bad advice. The first problem is that
we have no way to determine who the "regulars" are
much less whether or not they have any credentials,
training or experience in C++ compiler implementation.
We have no way to determine whether their interpretations
of the ANSI/ISO standards are correct or not.


You don't have to implement a compiler to know one is wrong.
In fact, once you gain some experience, you'll learn what's
easy and what's impossible without implementing one. And
for 99% of the questions here, any interpretation backed by
a quote is correct simply because there is no misinterpretation
possible. The "expert" part is finding the right quote.
Regards,
Michiel Salters

Jul 23 '05 #10
In message <ct**********@nntp1.jpl.nasa.gov>, E. Robert Tisdale
<E.**************@jpl.nasa.gov> writes
Some guy wrote:
E. Robert Tisdale wrote:
The compiler is a *much* more reliable judge of legal C++ code
than "some guy" who subscribes to the comp.lang.c++ newsgroup. I think that's a pretty bad assessment.
How can someone know if their compiler is any good (compliant)
if they don't themselves know what should be correct?


First of all, there are *no* C++ compiler which comply fully
with the ANSI/ISO standards.


Which rules out *your* suggestion above that the compiler is an
appropriate tool to test compliance.
The Comeau compilers come very close.
It is practically impossible for programmers to determine
for themselves whether any implementation complies or not.
In many cases, not all, it's trivial. Give it some test code, see
whether it compiles and how the compiled code behaves.

But you've digressed. The original question was about whether a piece of
*code* complied with the standard, not some compiler. Other posters
answered the question, complete with citations of the relevant portion
of the standard. If you don't trust them, you can read the standard for
yourself.
This newsgroup has some folks who are pretty darn good at
interpreting the standard doc's
And many more who are not.
How to you tell the difference.


By reading their reasoned arguments? By reading the standard for
yourself? The question here was straightforward enough, and so directly
answered by the standard, that questions of "interpretation" just didn't
arise.
and presenting the OP with good responses. Who would you trust, your
VC++ 6.0 compiler, or one of the regulars here?


I *don't* trust the "regulars here".


Good advice, since you're one of them.
The comp.lang.c++ newsgroup is *not* the most appropriate forum
to discuss the ANSI/ISO C++ standards or whether or not
any particular implementation complies.
The comp.std.c++ newsgroup is more appropriate.
comp.std.c++ is the appropriate place for discussing the standard and
proposed changes to it. It's not necessarily the best place for
discussing compliance of some random compiler, still less some random
snippet of code.
The comp.std.c++ newsgroup attracts real experts
on the ANSI/ISO C++ standards so contributions
are more likely to be properly vetted.
Contributions making assertions about the standard, certainly.
I'd listen to the regulars (and the FAQ), myself.


That's probably bad advice. The first problem is that
we have no way to determine who the "regulars" are
much less whether or not they have any credentials,
training or experience in C++ compiler implementation.


And how is that any different for the "regulars" of comp.std.c++?

Some of the "regulars" here make testable claims. Some of them have
names and reputations outside this newsgroup. Some of them *are* the
"real experts" you think inhabit comp.std.c++.
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?

--
Richard Herring
Jul 23 '05 #11
msalters wrote:

[ ... ]
Of course, the clc++m group attracts real experts as well. Reason
is simple, moderation keeps the traffic low enough. In fact, such
a trivial question would fit better here or in clc++m than in csc++


clc++/clc++m have similar aims: discussion of the language as it stands
right now. csc++ has a completely different aim: to discuss the
standard for the language, how it should be changed, etc.

The difference here is not one of the level of expertise, but of
orientation. Most of the regulars in csc++ also participate on a
regular basis in clc++ and/or clc++m as well.
That's probably bad advice. The first problem is that
we have no way to determine who the "regulars" are
much less whether or not they have any credentials,
training or experience in C++ compiler implementation.
Google makes it easy to find regulars, but posting and dependability
are (unfortunately) more or less orthogonal.

Standard conformance is largely a question of facts (or lack thereof),
and is thus easier to evaluate on its own merits. The place you really
want to look for expertise is when somebody is giving advice about
programming technique. Here you're (largely) taking a guess at what's
likely to become useful in the future, so you're hoping that the
expert's experience will guide you into making decisions that turn out
well -- but knowing up front that no matter what you do, you're
basically playing the odds, with no facts about "right" or "wrong"
available until after the fact.

Even so, I, at least, believe that your judgement should be based more
on the qualities apparent in the arguments themselves than in the
reputation of the person who makes them. Just for one example, I can
remember the first few posts Andrei Alexandrescu made to comp.lang.c++:
he had virtually never posted anything, anywhere before, and I'd
certainly never heard of him before (this was well before he was
published). Dismissing him out of hand on that basis would have been a
_major_ mistake, at least IMO.
We have no way to determine whether their interpretations
of the ANSI/ISO standards are correct or not.


You don't have to implement a compiler to know one is wrong.
In fact, once you gain some experience, you'll learn what's
easy and what's impossible without implementing one. And
for 99% of the questions here, any interpretation backed by
a quote is correct simply because there is no misinterpretation
possible. The "expert" part is finding the right quote.


I'm not at all sure I'd agree with the 99% number, but there are
certainly quite a few questions for which the answers are sufficiently
well known that one quote from the correct part of the standrad
suffices as an answer.

A single quote will rarely suffice for an expert-level question though.
A difficult question might easily require bits and pieces from a half
dozen (often widely-separated) parts of the standard to resolve.

Worse, the standard is sufficiently large that when those half dozen
parts are combined, the result can be _most_ surprising to those who
think they know the standard the best (it certainly suprises me on a
regular basis).

--
Later,
Jerry.

The universe is a figment of its own imagination.

Jul 23 '05 #12
REH

"Howard" <al*****@hotmail.com> wrote in message
news:3t*****************@bgtnsc04-news.ops.worldnet.att.net...

"E. Robert Tisdale" <E.**************@jpl.nasa.gov> wrote in message
news:ct**********@nntp1.jpl.nasa.gov...
REH wrote:
The compiler is a *much* more reliable judge of legal C++ code
than "some guy" who subscribes to the comp.lang.c++ newsgroup.
I think that's a pretty bad assessment. How can someone know if their
compiler is any good (compliant), if they don't themselves know what

should be correct? This newsgroup has some folks who are pretty darn good at
interpreting the standard doc's and presenting the OP with good responses.
Who would you trust, your VC++ 6.0 compiler, or one of the regulars here?
I'd listen to the regulars (and the FAQ), myself.

-some guy

That's quoted wrong. He wrote that crap, not me!

REH


Jul 23 '05 #13
REH

"Greg Comeau" <co****@panix.com> wrote in message
news:ct**********@panix1.panix.com...
In article <ct*********@cui1.lmms.lmco.com>, REH <bo***@nowhere.net> wrote:
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?


Notwithstanding that your foo above is defined incorrectly,


Yes, sorry, I was just trying too quickly to sketch an example of what I
wrote.
As you mentioned, despite the legality, it may not necessarily
be what you wanted, or it may be (this becomes more transparent
with templates).

Other than clarity or style/preferences (or the surprise!), is there a
reason why it's not what I wanted? I assume, from what I've been told, is
it's the same (functionally) as what I did want.

Thanks.
Jul 23 '05 #14

"REH" <bo***@nowhere.net> wrote in message
news:ct*********@cui1.lmms.lmco.com...

"Howard" <al*****@hotmail.com> wrote in message
news:3t*****************@bgtnsc04-news.ops.worldnet.att.net...

"E. Robert Tisdale" <E.**************@jpl.nasa.gov> wrote in message
news:ct**********@nntp1.jpl.nasa.gov...
> REH wrote:
>
>
> The compiler is a *much* more reliable judge of legal C++ code
> than "some guy" who subscribes to the comp.lang.c++ newsgroup.
....

That's quoted wrong. He wrote that crap, not me!

REH


Sorry, I forgot to take out the line with "REH wrote:" when I snipped all
the stuff at the top.

-H
Jul 23 '05 #15
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.

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).
I have observed that, when the same question is submitted
to both comp.lang.c++ and comp.std.c++ independently,
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.

What I find most interesting is that many so-called experts
pronounced the original code snippet

void foo
{
}

void bar()
{
return foo();
}

submitted by REH "legal".
Evidently, none of them ever attempted to compile it.
In this case, *any* C++ compiler would have been
more reliable that the so-called experts.

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.
The comp.lang.c++ newsgroup is just a good place to get bad advice
on "legal" issues concerning ANSI/ISO C++ standards.
Jul 23 '05 #16
REH

"E. Robert Tisdale" <E.**************@jpl.nasa.gov> wrote in message
news:ct**********@nntp1.jpl.nasa.gov...
What I find most interesting is that many so-called experts
pronounced the original code snippet

void foo
{
}

void bar()
{
return foo();
}

submitted by REH "legal".
Evidently, none of them ever attempted to compile it.
In this case, *any* C++ compiler would have been
more reliable that the so-called experts.

I don't think they pronounced it legal or felt the need to compile it.
They, being smarter than a compiler, understand my mistake and intent, and
just answered my question. Sheesh, it was just an example to help convey
what I was trying to say.
Jul 23 '05 #17
REH wrote:
E. Robert Tisdale wrote:
What I find most interesting is that many so-called experts
pronounced the original code snippet

void foo
{
}

void bar()
{
return foo();
}

submitted by REH "legal".
Evidently, none of them ever attempted to compile it.
In this case, *any* C++ compiler would have been
more reliable that the so-called experts.


I don't think they pronounced it legal or felt the need to compile it.
They, being smarter than a compiler, understand my mistake and intent
and just answered my question.
Sheesh, it was just an example to help convey what I was trying to say.


Someday, we will have compilers that are that smart. ;-)
They will emit code code for the program that we should have written
instead of for the program that we actually wrote.
What will we need programmers for then?
Jul 23 '05 #18

E. Robert Tisdale wrote:
Some guy wrote:
E. Robert Tisdale wrote:
The compiler is a *much* more reliable judge of legal C++ code
than "some guy" who subscribes to the comp.lang.c++ newsgroup.


I think that's a pretty bad assessment.
How can someone know if their compiler is any good (compliant)
if they don't themselves know what should be correct?


First of all, there are *no* C++ compiler which comply fully
with the ANSI/ISO standards.


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?!
I'm confused.

Jul 23 '05 #19
Noah Roberts wrote:
E. Robert Tisdale wrote:
Some guy wrote:
E. Robert Tisdale wrote:

The compiler is a *much* more reliable judge of legal C++ code
than "some guy" who subscribes to the comp.lang.c++ newsgroup.

I think that's a pretty bad assessment.
How can someone know if their compiler is any good (compliant)
if they don't themselves know what should be correct?
First of all, there are *no* C++ compiler
which comply fully with the ANSI/ISO standards.

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.
I'm confused.

Jul 23 '05 #20
In message <ct**********@nntp1.jpl.nasa.gov>, 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
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
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: ? ...
16
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...
15
by: Nerox | last post by:
Hi, If i write: #include <stdio.h> int foo(int); int main(void){ int a = 3; foo(a); }
18
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
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...
18
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
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
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. ...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

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.