Sign in to follow this  
Followers 0
JohnOne

Variable Argument Lists

4 posts in this topic

I'm not really after discussing these for use, nor would I be so bold as to make what I want to hear

about, a feature request.

Rather an idea as to how difficult a task it would be to implement such functionality into

AutoIt, but not without first conceding that I have only just got to reading about ...

va_list

va_start

va_end

I do though of course think that such functionality would be a great feature in the language, while

I also realize the accepted workaround is to pass an array as an arg to an function.

Would this sort of thing require a whole new Func type Keyword?


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I do though of course think that such functionality would be a great feature in the language,

Variable argument lists are very rarely used in user code. They are useful in specific cases in libraries and by far the most common use I have for them is in a wrapper or hook function. The intermediary function accepts some of the arguments and a variable argument list. It does it's thing on the arguments it cares about and then forwards everything to the original function. In C++ the only time I've ever used it is centered around using some of the C string formatting functions.

The point is, while it can be a useful feature, it's not a game changer or anything. Most people do not need it.

Would this sort of thing require a whole new Func type Keyword?

No. Edited by Valik

Share this post


Link to post
Share on other sites

In the tutorial I was reading it did mention that printf "can accept a variable list of arguments"

So I guess that could be the "C string formatting functions" you spoke of.

I've probably only once found myself looking for such a feature in AutoIt once, but quickly just

used an array.

I never knew such a thing existed in C++, It's a pretty great feature I think even if the same

effect can be achieved in other ways.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

It's not great feature in a heavily typed language. It's not type safe. That's why printf() and similar are so dangerous and crash prone.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0