<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=Talk%3AVariadic_function</id>
	<title>Talk:Variadic function - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=Talk%3AVariadic_function"/>
	<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=Talk:Variadic_function&amp;action=history"/>
	<updated>2026-05-10T23:40:37Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>http://debianws.lexgopc.com/wiki143/index.php?title=Talk:Variadic_function&amp;diff=1411716&amp;oldid=prev</id>
		<title>imported&gt;Seamusdemora at 19:21, 28 February 2024</title>
		<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=Talk:Variadic_function&amp;diff=1411716&amp;oldid=prev"/>
		<updated>2024-02-28T19:21:11Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Talk header}}&lt;br /&gt;
{{WikiProject banner shell|class=Start|1=&lt;br /&gt;
{{WikiProject Computing|importance=Mid}}&lt;br /&gt;
{{WikiProject C/C++|importance=Mid|c=yes|c++=yes}}&lt;br /&gt;
}}&lt;br /&gt;
{{todo}}&lt;br /&gt;
&lt;br /&gt;
== Optargs and kwargs aren&amp;#039;t varargs ==&lt;br /&gt;
&lt;br /&gt;
Removed from the article for discussion:&lt;br /&gt;
&lt;br /&gt;
:&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Optional arguments with default values&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
:&amp;#039;&amp;#039;Besides the concept of a &amp;#039;&amp;#039;completely arbitrary number&amp;#039;&amp;#039; of arguments as discussed above, the declaration of &amp;#039;&amp;#039;&amp;#039;[[default value]]s&amp;#039;&amp;#039;&amp;#039; for &amp;#039;&amp;#039;some&amp;#039;&amp;#039; of the &amp;#039;&amp;#039;specified arguments&amp;#039;&amp;#039; is another concept allowing to call a function with variable number of arguments. Several [[typed language]]s implement this, and can in some cases associate the arguments to the corresponding variables in view of their type, even if they are given at [[call-time]] in an order differing from the declaration. In languages which are not (strongly) typed (such as PHP), such [[optional argument]]s with default values cannot precede [[mandatory]] arguments without default value. (An exception are some system functions of PHP, like [http://php.net/implode the implode function], that can associate arguments given in any order to the right variables, in view of their type.)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Optional arguments (optargs) do not make a function variadic, even though it may look that way if you examine only the calling code. When a function with optargs is executed, each of the args is bound to some value -- be it a supplied value from the function call, a default value from the function definition, or a null value in the absence of a default value.&lt;br /&gt;
&lt;br /&gt;
The same is true for keyword arguments (kwargs), as in Python or Common Lisp -- a keyword argument gets populated with a value from the call, or it doesn&amp;#039;t and defaults to a null value, but it&amp;#039;s still bound in the environment under which the function-body is evaluated.&lt;br /&gt;
&lt;br /&gt;
What&amp;#039;s going on in variadic functions (varargs, rest args) is that passed-in arguments are &amp;#039;&amp;#039;not&amp;#039;&amp;#039; each used to supply a value for a variable. The handling of the list of passed-in arguments is under the control of the function code itself. Instead of binding a bunch of variables, the arguments are passed in as a list. (Or, in some languages, a list and a length.) This is why C bozos can walk off the end of a varargs list and end up smashing the stack. --[[User:Fubar Obfusco|FOo]] 23:17, 26 May 2005 (UTC)&lt;br /&gt;
&lt;br /&gt;
In the case of Python, isn&amp;#039;t this a case of a [[distinction without a difference]] in that a function ends up with a variable number of arguments that it can access. Putting aside the default arguments, Python &amp;#039;&amp;#039;does&amp;#039;&amp;#039; have variadic functions. --[[User:Paddy3118|Paddy]] ([[User talk:Paddy3118|talk]]) 12:48, 23 June 2008 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Variadic functions in C and C++ ==&lt;br /&gt;
The code example in this section is not commented at all, nor is there a caption explaining what its purpose is.  This should be corrected. --[[User:Walkeraj|Walkeraj]] 22:06, 3 October 2007 (UTC)&lt;br /&gt;
:...and a C example would also be nice, especially because there exists the [[variadic macro]] article. --[[User:Abdull|Abdull]] 09:17, 4 December 2007 (UTC)&lt;br /&gt;
&lt;br /&gt;
I was hoping to find an example here of how to create a variadic function wrapping another such function.&lt;br /&gt;
&lt;br /&gt;
 Label *createLabel(Object *owner, const char * format, ...) {&lt;br /&gt;
   char labelDescription[200];&lt;br /&gt;
   snprintf(labelDescription, 200, format, /* What goes here?? */);&lt;br /&gt;
   return new Label(owner, labelDescription);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[Special:Contributions/99.67.239.69|99.67.239.69]] ([[User talk:99.67.239.69|talk]]) 01:09, 3 May 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
: Use vsnprintf():  https://en.cppreference.com/w/c/io/vfprintf  --[[Special:Contributions/2003:E3:B725:FC00:71C9:1666:9CE0:20D9|2003:E3:B725:FC00:71C9:1666:9CE0:20D9]] ([[User talk:2003:E3:B725:FC00:71C9:1666:9CE0:20D9|talk]]) 12:41, 11 May 2022 (UTC)&lt;br /&gt;
&lt;br /&gt;
== manual tag ==&lt;br /&gt;
&lt;br /&gt;
I&amp;#039;ve added the {{[[Template:manual|manual]]}} tag to the section on specific implementations. A brief, prose overview with perhaps one  or two examples might be useful, but what we have is just a sprawling reference manual on how to use variadic parameter passing in multiple languages, and that&amp;#039;s not what a Wikipedia article is for. -[[User:Miskaton|Miskaton]] ([[User talk:Miskaton|talk]]) 12:54, 11 April 2008 (UTC)&lt;br /&gt;
: I agree. Considering that no-one has objected in the past 3 years, I&amp;#039;m going to remove all the notes about specific implementations -- each language which support variadic functions should have their own section about it, instead of having a large collection of semi-useful often poorly written sections here. [[Special:Contributions/80.162.60.16|80.162.60.16]] ([[User talk:80.162.60.16|talk]]) 13:08, 23 July 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
: I would prefer you remove them and instead reference the newly added Rosetta Code task from the external links section. --[[User:Paddy3118|Paddy]] ([[User talk:Paddy3118|talk]]) 06:31, 24 July 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
==Vararg function implementations can be divided into 3 classes==&lt;br /&gt;
What is the use of such a classification?&amp;lt;br&amp;gt;The list on its own is of very little use and should be deleted. --[[User:Paddy3118|Paddy]] ([[User talk:Paddy3118|talk]]) 05:35, 30 July 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Usefulness of vadiadic functions? ==&lt;br /&gt;
&lt;br /&gt;
Is there any advantage to using a vadiadic function over say, a list? Perhaps it&amp;#039;s more useful in a language like C where you can&amp;#039;t construct lists easily? What are the advantages/disadvantages? Language bloat?  &amp;lt;span style=&amp;quot;font-size: smaller;&amp;quot; class=&amp;quot;autosigned&amp;quot;&amp;gt;—Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/99.224.181.247|99.224.181.247]] ([[User talk:99.224.181.247|talk]]) 00:16, 12 May 2011 (UTC)&amp;lt;/span&amp;gt;&amp;lt;!-- Template:UnsignedIP --&amp;gt; &amp;lt;!--Autosigned by SineBot--&amp;gt;&lt;/div&gt;</summary>
		<author><name>imported&gt;Seamusdemora</name></author>
	</entry>
</feed>