By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,305 Members | 1,619 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,305 IT Pros & Developers. It's quick & easy.

variable argument lists and ..

P: n/a

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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.