473,657 Members | 2,513 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

question on function arguments and parameter passing

Hi. Question: In a function that takes multiple arguments, each with a
default value set[EX: void blah(int one=1, int two=2, int three=3);]is
there anyway to either alter the order of the parameters you pass to it
or skip the passing of certain parameters[sort of like(if I wanted to
let "two" take on the default): blah(12, three=53); or blah(12,,53); or
blah(12,default ,53);]?

I'm mainly asking because lately I've had to do some gui programming,
calling a widget function that takes like 80 defaulted arguments, with
only a single one I want to alter, makes me hate life.

Sorry if there's recently been a similar post.

Thanks.

Nov 14 '05 #1
2 1422


xideum wrote:
Hi. Question: In a function that takes multiple arguments, each with a
default value set[EX: void blah(int one=1, int two=2, int three=3);]


This isn't C; C's function arguments do not have
default values. You must be thinking of some other
programming language.

--
Er*********@sun .com

Nov 14 '05 #2
On 24 Mar 2005 07:01:24 -0800, "xideum" <xi****@gmail.c om> wrote:
Hi. Question: In a function that takes multiple arguments, each with a
default value set[EX: void blah(int one=1, int two=2, int three=3);]is
there anyway to either alter the order of the parameters you pass to it
or skip the passing of certain parameters[sort of like(if I wanted to
let "two" take on the default): blah(12, three=53); or blah(12,,53); or
blah(12,defaul t,53);]?

I'm mainly asking because lately I've had to do some gui programming,
calling a widget function that takes like 80 defaulted arguments, with
only a single one I want to alter, makes me hate life.

Sorry if there's recently been a similar post.

You should ask in a group which deals with your programming language
(which is obviously not C, the language this group deals with). Have
you considered writing a wrapper function which takes your one
argument and expands it to a call with all 80 arguments?

--
Al Balmer
Balmer Consulting
re************* ***********@att .net
Nov 14 '05 #3

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

Similar topics

3
14928
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) { document.images.src = eval("mt" +menu+ ".src") } alert("imgOff_hidemenu"); hideMenu=setTimeout('Hide(menu,num)',500);
2
7671
by: laredotornado | last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to have my Javascript function execute from the BODY's "onload" method, but if there is already an onload method defined, I would like mine to run immediately after it. So in the code below, what JS would i need to add to my "myfile.inc" page so that I could guarantee this behavior? <!-- main page --> <html> <head> <script type="text/javascript">
39
7639
by: Mike MacSween | last post by:
Just spent a happy 10 mins trying to understand a function I wrote sometime ago. Then remembered that arguments are passed by reference, by default. Does the fact that this slowed me down indicate: a) That I don't know enough b) Passing arguments by ref is bad
17
1278
by: pratik | last post by:
i am working a turbo c; the code i typed in is as follows #include<stdio.h> main() { int a=5; printf("%d%d%d",a++,++a,a); } The output of the above code is very interesting. can anyone help me with the output of the above code
5
1322
by: Martin Johansen | last post by:
Hello C programmers If I have a function, say void f(int a, char b); And I call this function with the following arguments char a; int b;
6
1466
by: enjoying the view | last post by:
I am working on a school project, trying to build a simple RPC stub generator. The idea is that the generator takes a normal python file with functions defined in it and produces a client and server stub. The client stub has the same functions defined, but they just connect to the server and ask it to call the desired functions. The server stub is a server listening for incoming requests and dispatching them to the appropriate functions...
18
4342
by: John Friedland | last post by:
My problem: I need to call (from C code) an arbitrary C library function, but I don't know until runtime what the function name is, how many parameters are required, and what the parameters are. I can use dlopen/whatever to convert the function name into a pointer to that function, but actually calling it, with the right number of parameters, isn't easy. As far as I can see, there are only two solutions: 1) This one is portable. If...
28
4307
by: Larax | last post by:
Best explanation of my question will be an example, look below at this simple function: function SetEventHandler(element) { // some operations on element element.onclick = function(event) {
10
13016
by: Janus | last post by:
Hi, Is there a way to pass arguments to the callback function used inside an addEventListener? I see that I can only list the name of the callback function. For eg, I use this: var boldLink=document.getElementById('cmtbold');
0
8413
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8324
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8842
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7352
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.