www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - inout and variadic functions

reply Tyro <Tyro_member pathlink.com> writes:
Is there anything fundamentally wrong with a variadic function parameters being
defined as such:

void foo(inout ...){}

If so, please explain why. Otherwise please add this feature. 

Thanks,
Andrew
Dec 20 2004
next sibling parent reply Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
Tyro wrote:
 Is there anything fundamentally wrong with a variadic function parameters being
 defined as such:
 
 void foo(inout ...){}

This might be an interesting way to implement a scanf alternative. Although with something like scanf, 'out' might make more sense than 'inout'.
Dec 20 2004
parent Tyro <Tyro_member pathlink.com> writes:
In article <cq777v$nmp$1 digitaldaemon.com>, Russ Lewis says...
Tyro wrote:
 Is there anything fundamentally wrong with a variadic function parameters being
 defined as such:
 
 void foo(inout ...){}

This might be an interesting way to implement a scanf alternative. Although with something like scanf, 'out' might make more sense than 'inout'.

This is precisely my reason for asking! Though out is better for scanf(), I think both out and inout should be authorized for use in this manner.
Dec 20 2004
prev sibling parent "Simon Buchan" <currently no.where> writes:
On Mon, 20 Dec 2004 18:28:58 +0000 (UTC), Tyro <Tyro_member pathlink.com>  
wrote:

 Is there anything fundamentally wrong with a variadic function  
 parameters being
 defined as such:

 void foo(inout ...){}

 If so, please explain why. Otherwise please add this feature.

 Thanks,
 Andrew

I would rather have a little more contol in general on these functions, things like foo(bar ree, out uint outArgs..., in uint inArgs...) {} would be nice, (although I can't think of an explicit exapmle where you want this checked at compile-time) but I wonder what the syntax would be like? inArgs.ptr? outArgs[4].typeid? Could be interesting to discuss, at least. -- "Unhappy Microsoft customers have a funny way of becoming Linux, Salesforce.com and Oracle customers." - www.microsoft-watch.com: "The Year in Review: Microsoft Opens Up" -- "I plan on at least one critical patch every month, and I haven't been disappointed." - Adam Hansen, manager of security at Sonnenschein Nath & Rosenthal LLP (Quote from http://www.eweek.com/article2/0,1759,1736104,00.asp) -- "It's been a challenge to "reteach or retrain" Web users to pay for content, said Pizey" -Wired website: "The Incredible Shrinking Comic"
Dec 21 2004