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

A question about variable-argument lists

A function foo is defined as:
int foo(string, ...);

How to determine there are how many arguments in the list?
Dec 28 '07 #1
2 1378
cu***********@yahoo.com.cn wrote:
A function foo is defined as:
int foo(string, ...);

How to determine there are how many arguments in the list?
There is no explicit means for doing so, but it should be possible to
infer this information somehow if the function is sensibly designed.

http://cppreference.com/stdother/va_arg.html

--
Mike Smith
Dec 28 '07 #2

<cu***********@yahoo.com.cnwrote in message
news:6c**********************************@t1g2000p ra.googlegroups.com...
>A function foo is defined as:
int foo(string, ...);

How to determine there are how many arguments in the list?
The function needs to be told the number
and types of arguments (e.g. by the caller
via another argument). That's how 'printf()'
does it.

-Mike
Dec 29 '07 #3

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

Similar topics

11
by: kazack | last post by:
I am under the the impression that a variable is what is stored in a memory address and a pointer is the memory address of the variable? I was looking to use a function that does not return a...
3
by: Joe C | last post by:
I have some code that performs bitwise operations on files. I'm trying to make the code portable on different endian systems. This is not work/school related...just trying to learn/understand. ...
3
by: William Gill | last post by:
Working with tkinter, I have a createWidgets() method in a class. Within createWidgets() I create several StringVars() and assign them to the textvariable option of several widgets. Effectively my...
7
by: Edward Yang | last post by:
A few days ago I started a thread "I think C# is forcing us to write more (redundant) code" and got many replies (more than what I had expected). But after reading all the replies I think my...
1
by: Chris Austin | last post by:
A co-worker asked me today what would happen if Session.Add() method was called multiple times with the same key. My first thought was that it would throw some sort of duplicate key exception. ...
9
by: JoeC | last post by:
I am trying to create a simple maze program on a window. I am trying to create a global var to handle the commands. I declare: #include "space.h" #include "player.h" #include "Command.h" ...
30
by: questions? | last post by:
say I have a structure which have an array inside. e.g. struct random_struct{ char name; int month; } if the array is not intialized by me, in a sense after I allocated a
13
by: yanlinlin82 | last post by:
I'd like to write all code of a class in only header file. But when there is any static member varia ble, I have to define it in cpp file, not the header file. Otherwise, the static member variable...
7
by: David Mathog | last post by:
I accidentally did this the other day (it was a lot less obvious in the much longer actual program, hundreds of lines are omitted): ----------------------------------------------------------...
15
by: SM | last post by:
Hello, I have another simple question about an array in PHP and a variable in PHP. This is the array: $thumbs_cat_1 = array( 'wine', 'cheese', 'ice',
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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: 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
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
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...

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.