473,388 Members | 1,391 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,388 software developers and data experts.

How can I nest variadic functions?

Hi

Is it possible to next variadic functions. Eg if I wish to do
something like this...

void mainfunc(char *fmt, ...)
{

Sep 17 '07 #1
2 1316
Boltar <bo********@yahoo.co.ukwrites:
Is it possible to next variadic functions. Eg if I wish to do
something like this...

void mainfunc(char *fmt, ...)
{
Looks like you hit Send before you finished writing your article.

Function definitions cannot be nested, whether they're variadic or
not. You can *declare* a function inside a function definition:

void foo(void) /* definition of foo */
{
void bar(void); /* delaration of bar */
/* ... */
}

but there's rarely a good reason to do so and 'bar' has to be defined
somewhere else anyway.

See question 20.24 in the comp.lang.c FAQ, <http://www.c-faq.com/>.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Sep 17 '07 #2
Keith Thompson <ks***@mib.orgwrites:
Boltar <bo********@yahoo.co.ukwrites:
>Is it possible to next variadic functions. Eg if I wish to do
something like this...

void mainfunc(char *fmt, ...)
{

Looks like you hit Send before you finished writing your article.

Function definitions cannot be nested, whether they're variadic or
not. You can *declare* a function inside a function definition:

void foo(void) /* definition of foo */
{
void bar(void); /* delaration of bar */
/* ... */
}

but there's rarely a good reason to do so and 'bar' has to be defined
somewhere else anyway.

See question 20.24 in the comp.lang.c FAQ, <http://www.c-faq.com/>.
And I see from your other posting that I completely misunderstood what
you were asking.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Sep 17 '07 #3

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

Similar topics

2
by: Loony | last post by:
Hi, I want to use variadic functions with stl containers as arguments but I am not sure if that is possible and if so how. I'm using gcc 3.3 on Suse 8.2 Hope someone can help me. Thanx...
3
by: Loony | last post by:
Hi, I have a problem with my code. I am using a virtual class in which I define a variadic function. This class is inherited by another one which then implements it. The problem occurs while...
89
by: Sweety | last post by:
hi, Is main function address is 657. its show in all compiler. try it & say why? bye,
5
by: Christopher Benson-Manica | last post by:
Do variadic functions (such as printf()) always scan the format string for format specifiers, even when there are no additional arguments? If it is instead a QoI issue, what would be true for a...
19
by: Ross A. Finlayson | last post by:
Hi, I hope you can help me understand the varargs facility. Say I am programming in ISO C including stdarg.h and I declare a function as so: void log_printf(const char* logfilename, const...
2
by: Florian G. Pflug | last post by:
Hi I faintly remember that I once stumbled upon a way to declare variadic functions (functions that take a variable number of arguments) in plpgsql - but I just searched the docs and can't find...
9
by: CryptiqueGuy | last post by:
Consider the variadic function with the following prototype: int foo(int num,...); Here 'num' specifies the number of arguments, and assume that all the arguments that should be passed to this...
4
by: Boltar | last post by:
Hi I think I posted a question similar to this on here a while back but I can't find the thread and I need something more general anyway. My problem is I have 2 variadic functions , one of...
8
by: Christof Warlich | last post by:
Hi, is there any way to access individual elements in the body of a variadic macro? I only found __VA_ARGS__, which always expands to the complete list. Thanks for any help, Christof
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
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...

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.