473,394 Members | 1,715 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.

variable argument lists and ..


Hello,

Is it possible to use va lists if i prefare to define
functions as following:

(won't compile)

void
die(file, line, fn, fmt, ...)
const char *file;
const int line;
const char *fn;
const char *fmt;
{
/* code */
}

ps. also how is such function definition called?
(when i do not write 'int f(int i) { }' but 'int f(i) int i; { }')
Thanks,
P.Krumins
Nov 14 '05 #1
3 1617
Peteris Krumins <pk****************@inbox.lv> writes:
Is it possible to use va lists if i prefare to define
functions as following:
No, variable-length argument lists and K&R-style function
declarations don't mix.
ps. also how is such function definition called?
(when i do not write 'int f(int i) { }' but 'int f(i) int i; { }')


Typically "K&R-style function definitions", but the standard
calls them "function definitions with separate parameter
identifier and declaration lists".
--
"Give me a couple of years and a large research grant,
and I'll give you a receipt." --Richard Heathfield
Nov 14 '05 #2
Ben Pfaff <bl*@cs.stanford.edu> wrote in
news:87************@pfaff.stanford.edu:
Peteris Krumins <pk****************@inbox.lv> writes:
Is it possible to use va lists if i prefare to define
functions as following:


No, variable-length argument lists and K&R-style function
declarations don't mix.


Thanks.
ps. also how is such function definition called?
(when i do not write 'int f(int i) { }' but 'int f(i) int i; { }')


Typically "K&R-style function definitions", but the standard
calls them "function definitions with separate parameter
identifier and declaration lists".


And thanks.
P.Krumins
Nov 14 '05 #3
Peteris Krumins wrote:
Hello,

Is it possible to use va lists if i prefare to define
functions as following:

(won't compile)

void
die(file, line, fn, fmt, ...)
const char *file;
const int line;
const char *fn;
const char *fmt;
{
/* code */
}


A recent thread here discussed why using old-style function headers is a
bad idea. You can read that discussion here:

http://groups.google.com/groups?thre...pamblocked.com

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.
Nov 14 '05 #4

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

Similar topics

0
by: Philip Rittenhouse | last post by:
I have discovered a couple of problems with the way the universal gateway code handles optional parameters and variable argument lists in COM servers. It appears to only be a problem when you...
7
by: Kapt. Boogschutter | last post by:
I'm trying to create a function that has at least 1 Argument but can also contain any number of Arguments (except 0 because my function would have no meaning for 0 argument). The arguments...
7
by: | last post by:
How to call a function with variable argument list from another function again with variable argument list? Example : double average ( int num, ... ); double AFunct1 ( int num, ... ); double...
5
by: Jonathan Burd | last post by:
Greetings everyone, I wrote a function to learn about variable-length argument lists. I wonder if there is a better way to detect the end of the argument list than using a sentinel value like...
3
by: Tomás | last post by:
Let's say we have a variable length argument list function like so: unsigned GetAverage(unsigned a, unsigned b, ...); I wonder does the compiler go through the code looking for invocations of...
9
by: Schraalhans Keukenmeester | last post by:
I have some C functions (with variable length argument lists) that use void pointers as arguments. Is there a way to determine at runtime what type of parameter is actually passed on to the...
6
by: CptDondo | last post by:
How do you declare a function with 0 or mroe arguments? I have a bunch of functions like this: void tc_cm(int row, int col); void tc_do(void); void tc_DO(int ln); and I am trying to ...
9
by: Chad | last post by:
This might be a bit vague and poorly worded..... In my program, I handle function failures using fprintf() and exit() like: fprintf(stderr, "malloc failed"); exit(EXIT_FAILURE); There...
19
by: Spiros Bousbouras | last post by:
Every time I've seen an example of a variable argument list function its functionality was to print formatted output. Does anyone have examples where the function is not some variation of printf ?
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
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
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.