home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!portal!dfuller
- From: dfuller@portal.hq.videocart.com (Dave Fuller)
- Subject: Re: Multiple Parameter Passing (unspecified number)
- Message-ID: <BxvnxL.67v@portal.hq.videocart.com>
- Organization: VideOcart Inc.
- X-Newsreader: Tin 1.1 PL3
- References: <1992Nov17.105837.21867@henson.cc.wwu.edu>
- Date: Tue, 17 Nov 1992 20:36:57 GMT
- Lines: 33
-
- n8743196@henson.cc.wwu.edu (Jeff Wandling) writes:
- :
- : System: Sun 3/50, SunOS 4.1.1b
- :
- : I'm trying to do a similar thing, except my function doesn't know what type
- : to expect. The next "variable argument" could be any simple type. How
- : do I deal with this? Is there a way to switch on the type of the next
- : argument? When using union's for example---
- :
- :
- : hash_insert(table,name,...)
- : ....
- : {
- :
- : ....
- : va_list argp;
- :
- : type = va_"type?"(argp,???);
- :
- : ....
- : }
- :
-
- Only if used like printf(). Printf knows what to cast the next parm as
- because you tell it what type you are passing it in the display description
- string. i.e. "num %d: name:%s"
- printf will cast the first parm to an int, the second to a char*.
- If you want pass random types, you have to also give the routine a way
- of knowing what the values are supposed to be.
-
- Dave Fuller
- dfuller@portal.hq.videocart.com
-
-