473,394 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Functions problem

Hello,

I've got the following problem. FuncB uses recursion and calls itself.
Sometimes FuncB calls FuncA, but then FuncA should call FuncB ... which
actually returns an error..

void FuncA(){
FuncB();
}

void FuncB(){
FuncB();
FuncA();
}

Ani ideas how to make that thing work ...

Dec 30 '05 #1
8 1122
> ... which actually returns an error..

What error? If your call stacks goes out of limit, probably you should
write something like

void FuncA(){
if ( "not enough yet")
FuncB();
}
void FuncB(){
FuncB();
if ( "not enough yet")
FuncA();
}

somehow the recursion must stop at some time

Dec 30 '05 #2
The recursion has an end, but I get:
"conflicting types for 'FuncB' "

Dec 30 '05 #3
plus:
"previous implicit declaration of 'FuncB' was here"

Dec 30 '05 #4
itprotal:
The recursion has an end, but I get:
"conflicting types for 'FuncB' "


It's still a bit unclear what the exact error is, is the compiler
complaining about the return type of function FuncB? Could you post the
whole and complete message, and even some code, may-be?

Dec 30 '05 #5
Did you declare FuncB before using it in FuncA? It sounds as though
perhaps you didn't.

If that's not it, then I suggest that you should post the actual code
which causes this problem, because nothing in the snippet you posted is
missing whatever it is that's causing your code not to work.

Luke

Dec 30 '05 #6
> "previous implicit declaration of 'FuncB' was here"

Could you possibly have mistaken a statement that calls FuncB, and a
statement that defines FuncB

Like:

// defines the function, make the following code aware there is such a
function, but does not call it
void FuncB(int j, int k);
// calls the function
FuncB(j,k);

the difference is the types you declare in a definition, "void" as
return, and two "ints" for the parameters in this example.

Marc

Dec 30 '05 #7
The code is very long an complicated.

I have probably made wrong declarations. I declared the functions and
now I get the error:
[Linker error] undefined reference to `FuncA'

Dec 30 '05 #8
Oppps ... I've mistaken the name of the funcs.

Now everything is OK.

The problem had been that I haven't decalred the funcs. So long code
that I get lost in it ;)

10x

Dec 30 '05 #9

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

Similar topics

99
by: David MacQuigg | last post by:
I'm not getting any feedback on the most important benefit in my proposed "Ideas for Python 3" thread - the unification of methods and functions. Perhaps it was buried among too many other less...
2
by: Wenjie | last post by:
Hello, I read someone posted assertions that even the (public) member function is not static, there are probably only one copy of the code in the executable. Then except the...
25
by: Stijn Oude Brunink | last post by:
Hello, I have the following trade off to make: A base class with 2 virtual functions would be realy helpfull for the problem I'm working on. Still though the functions that my program will use...
9
by: Gibby Koldenhof | last post by:
Hiya, Terrible subject but I haven't got a better term at the moment. I've been building up my own library of functionality (all nice conforming ISO C) for over 6 years and decided to adopt a...
30
by: Will Pittenger | last post by:
Does C# inline functions? I do not see a inline keyword. Is there an implicit inline? Can the compiler select functions for auto-inlining? I am more used to C++ where all these things are...
22
by: TC | last post by:
I have an Access database application with a lot of custom row functions written in VBA. In other words, a lot of queries contain calculated fields which use functions defined in the modules. I...
1
by: ashutosh | last post by:
hi, i am making the dll for clamav antivirus libraray so that i can make activex control for windows. i complied the library successfully and make the Libclamav.dll file using win32 Api...
23
by: Timothy Madden | last post by:
Hello all. I program C++ since a lot of time now and I still don't know this simple thing: what's the problem with local functions so they are not part of C++ ? There surely are many people...
8
by: Edward Diener | last post by:
By reuse, I mean a function in an assembly which is called in another assembly. By a mixed-mode function I mean a function whose signature has one or more CLR types and one or more non-CLR...
14
by: v4vijayakumar | last post by:
Why we need "virtual private member functions"? Why it is not an (compile time) error?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...

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.